WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ianharris
    Member
    Posted 7 years ago #

    Hello,

    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?

    Help!

    Thanks

    Ian

  2. MichaelH
    Member
    Posted 7 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
    Member
    Posted 7 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
    Member
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags