Calling the Page title to use in a snippet of PHP (4 posts)

  1. ianharris
    Posted 9 years ago #


    I wonder if you could help me out with a quick question about PHP.

    Below is a snippet of code I use to call a particular plug-in, FAlbum:
    <?php global $falbum; ?><?php echo $falbum->show_random(4, 'restaurants',1,'s');?>

    Now, the 'restaurants' part of that code tells the plug-in to pull images off Flickr that have the tag 'restaurants'. So far, so good.

    But my question is: how can I replace that bit ('restaurants') with whatever happens to be the title of the current WordPress Page?

    I know that to return a Page's title you just use the code:
    <?php wp_title(); ?>

    But is it possible to squeeze that tag inside the other one?




  2. MichaelH
    Posted 9 years ago #

    Taking a shot here that what you need is to return (not display the result of the template tag, wp_title():

    <?php echo $falbum->show_random(4,wp_title("",false),1,'s');?>

  3. ianharris
    Posted 9 years ago #

    Thank you so much - that works beautifully. I don't really know any PHP - but I think I need to learn some to become proficient with hacking WordPress. Any chance you can recommend a good primer?

    Thanks again for your help

  4. MichaelH
    Posted 9 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic