Ian Batten
Ian Batten

Reputation: 211

How to use wordpress post title tag in PHP call to plugin

I'm using a flickrRSS plugin, and would like to use the search term as the title of the post, rather than a specified keyword.

Here is the code snippet I'm using:

get_flickrRSS(
  array('num_items' => 10,
        'type' => 'public',
        'tags' => 'keyword'
));

I'd like to change the "keyword" to the wordpress post title.

Any ideas how I can do this?

Many thanks.

Upvotes: 0

Views: 319

Answers (2)

user2019515
user2019515

Reputation: 4503

Not entirely sure but I believe this will work:

<?php
     global $post;
     $ID = $post->ID
     get_flickrRSS(
         array('num_items' => 10,
             'type' => 'public',
             'tags' => get_the_title($ID)
     ));
?>

Upvotes: 0

Simone
Simone

Reputation: 21282

Try get_the_title()

get_flickrRSS(
  array('num_items' => 10, 
        'type'      => 'public',
        'tags'      => get_the_title() 
  ));

Reference: https://codex.wordpress.org/Template_Tags/get_the_title

Upvotes: 1

Related Questions