WordPress.org

Ready to get started?Download WordPress

Forums

Passing WP Variable to a plugin (2 posts)

  1. rubendn
    Member
    Posted 7 years ago #

    I am trying to pass the title of a page to the get_flickrrss plugin.

    Here is my code:

    <?php $postname = $wp_query->post->post_title;?>
    <p align='center'><?php get_flickrrss(7, "public", $postname); ?></p>

    If I do an echo right after the first line to test, the post title is properly assigned to $postname, but when I include it in the get_flickrrss function it passes a blank value. I'm not too proficient with PHP so I'm not sure if the value has to be assigned another way to be able to pass it to the fucntion?

    Would really appreciate any help.

  2. rubendn
    Member
    Posted 7 years ago #

    I modified the code to the following to do more testing...

    <?php
    global $postname;
    $postname = $wp_query->post->post_title;
    echo $postname
    ?>
    <p align='center'><?php get_flickrrss(7, "public", $postname); ?></p>

    It does show the title of the post using the echo command but it does not properly pass the value to the get_flickrrss function.

    If I change the last line to:

    <p align='center'><?php get_flickrrss(7, "public", 'dog'); ?></p>

    it works fine and shows the 7 pictures of dogs.

Topic Closed

This topic has been closed to new replies.

About this Topic