Hi can somebody please tell me how to do the following: When i want to display the title in PHP I use: the_title(); OK I have the following Code: <?php query_posts(array( 'cat'=>'5', 'tag_slug__and'=>array('whatever'), ) );?> How can i display the_title() instead of the 'whatever'? I try to edit it but i keep getting a php error i do not know how to replace the text 'whatever' with the variable the_title().
I am using WordPress. Currently this code will search for all posts with the tag football. 'tag_slug__and'=>array('football'), However i need it so that it will search for all posts with a dynamic tag. The tag will be the title of the post. I just don't know how to insert it properly. I tried 'tag_slug__and'=>array(the_title() but then an error come up saying it expected the ' ' So i tried 'tag_slug__and'=>array('the_title();') but this does not work either.
Since 'the_title' isn't actually a variable (it's a function), try this instead. <?php $the_title=the_title(); query_posts( array( 'cat'=>'5', 'tag_slug__and'=>array($the_title), ) ); ?> PHP: