• Resolved Andrew

    (@rhdri)


    Hi,

    Thanks so much for the awesome plugin! I’m using WP 3.5.1 with TPG 2.03.00.

    I would like to generate a title for an entire set of posts in a particular category or with a certain tag. Here’s an example of the shortcode I’m using on my page now:

    [tpg_get_posts cat="Vacation Packages" tag="rome" show_byline="false" numberposts=0 orderby="title" show_excerpt="true" mag_layout="true" thumbnail_size="small" fields="title, content, metadata"]
    
    [tpg_get_posts cat="Vacation Packages" tag="venice" show_byline="false" numberposts=0 orderby="title" show_excerpt="true" mag_layout="true" thumbnail_size="small" fields="title, content, metadata"]

    If this code generates 3 posts from each tag (“rome” & “venice”), I would like a dynamically generated title to appear above each set of 3 posts like this:

    Rome

    • Post 1
    • Post 2
    • Post 3

    Venice

    • Post 1
    • Post 2
    • Post 3

      This is the code I tried using:

      $content .= '<div id="tpg-get-posts" ><div id="vacation-heading">
      <div id="vacation-heading-text">'.$this->get_my_tags($post->ID).'</div>
      </div>';

      But it just returned “No Tags” — I’m assuming because that code is supposed to fetch tags associated with individual posts, not the entire shortcode request.

      Is there a workaround for this? Something simple I’m missing?

      Thanks in advance.

    https://www.ads-software.com/extend/plugins/tpg-get-posts/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Criss Swaim

    (@cswaim)

    You are correct in the tag option will pull posts by tags.

    try this->r[‘tags’] to retrieve the tag value

    BUT….since this bit of custom code will be lost if you upgrade the plugin, be careful. Also, using the tag option may have other impacts. What you might try is to pass in an option like header=’venice’, which appends the option to the end of the plugin options array and then access as this->r[‘header’]

    Of course none of this is supported, but post your results back here as it may be helpful to others.

    Thread Starter Andrew

    (@rhdri)

    Thanks for the quick reply and the great suggestion. I will try that now.

    Also, is the post thumbnail image supposed to be linking to the individual post page? The title is doing so, but there seems to be no link generated for the thumbnail. I didn’t see an option to specify that in the shortcode, and when I looked in the php file it looked like the proper code to do that was already there.

    Please see https://theromanguy.com/new/custom-vacation-packages to view what I’m referring to.

    Thanks!

    Plugin Author Criss Swaim

    (@cswaim)

    the behavior is if the post information is displayed, then no link to the thumbnail is generated. The link is from the post heading. However, if the thumbnail_only flag is set, then a link is put on the thumbnail.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Generate Title for Entire Set of Posts’ is closed to new replies.