0

in a PHP file is possible get the title of a post with

the_title();

is it possible, in a JS file, get the title of a post?

many thanks

1 Answer 1

1

you can try document.title to get title

Sign up to request clarification or add additional context in comments.

2 Comments

Providing that the title of the document is set to the title of the post. I'm not WP expert, so I'd have a look through the DOM Tab on Firebug to see if you have an wp, wordpress or similar object set. That'll be where you find the name of the post. Otherwise, you'll just have to set it yourself.
@DanSchalow yes.getting post title by <?php wp_title(''); ?> in wordpress.find its object and get it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.