trying to run a PHP youtube v3 data in a WordPress theme


trying to store wp title in a variable so it won't echo the above API URL and it seems all method have tried isn't working &q='.$unity.' in the above code

List I tired

$unity = $post->post_tite;



and even more

is there still a way to make this work?


You're example is totally unclear. What is ngegrab, what is $unity, $yesPage and what do you mean with "WordPress title"? Short: what are you trying to do exactly?

To get the title of a post, use get_the_title() as mentioned in the other answer. To get the document title (<title></title>), use wp_get_document_title().

  • ngegrab is what am using to collect data from that URL (youtube v3). the unity is what am using to call back my variable for wp post title. the $yesPage is my next page variable. am only having the issue with the unity variable to call back Wordpress post title without echo – unity ekeinde Jan 24 '18 at 14:21
  • Then $unity = get_the_title( $your_post_id ) should totally do the trick. – swissspidy Jan 24 '18 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.