• 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.

Viewing 1 replies (of 1 total)
  • Thread Starter rubendn

    (@rubendn)

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Passing WP Variable to a plugin’ is closed to new replies.