WordPress.org

Ready to get started?Download WordPress

Forums

TPG Get Posts
[resolved] Generate Title for Entire Set of Posts (4 posts)

  1. Andrew
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/tpg-get-posts/

  2. cswaim
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Andrew
    Member
    Posted 1 year ago #

    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 http://theromanguy.com/new/custom-vacation-packages to view what I'm referring to.

    Thanks!

  4. cswaim
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic