Support » Plugin: TPG Get Posts » category_in not working

  • (I have the premium version)
    [tpg_get_posts category_in=”About” post_type=”page,post” orderby=”title” order=”asc” post_status=”publish” numberposts=-1 show_excerpt=”true” fields=”title,byline,metadata”] returns nothing.
    [tpg_get_posts category_in=”3″ post_type=”page,post” orderby=”title” order=”asc” post_status=”publish” numberposts=-1 show_excerpt=”true” fields=”title,byline,metadata”] returns nothing.
    [tpg_get_posts cat=”About” post_type=”page,post” orderby=”title” order=”asc” post_status=”publish” numberposts=-1 show_excerpt=”true” fields=”title,byline,metadata”] and [tpg_get_posts cat=”3″ post_type=”page,post” orderby=”title” order=”asc” post_status=”publish” numberposts=-1 show_excerpt=”true” fields=”title,byline,metadata”] both return:
    “About Me

    By Russ on January 29, 2010
    Comments Off on About Me | Filed under: About | Tags: BA, CSUN, Israel, usa, WEB
    About the Families

    By Russ on December 30, 2013
    Comments Off on About the Families | Filed under: About, Families, Genealogy | Tags: No Tag
    About This Site

    By Russ on January 26, 2010
    Comments Off on About This Site | Filed under: About | Tags: No Tag
    Access Levels

    By Russ on May 14, 2015
    Comments Off on Access Levels | Filed under: About This Site, Access | Tags: No Tag
    Comment Rules

    By Russ on July 21, 2006
    Comments Off on Comment Rules | Filed under: About This Site, Blog, Site Status | Tags: No Tag
    Genealogy Research

    By Russ on December 30, 2013
    Comments Off on Genealogy Research | Filed under: About, Blog, Genealogy, History, Sources | Tags: No Tag
    Legal Stuff

    By Russ on May 14, 2015
    Comments Off on Legal Stuff | Filed under: About | Tags: No Tag
    Reading Lists

    By Russ on May 4, 2015
    Comments Off on Reading Lists | Filed under: About Me, Happenings | Tags: No Tag
    Site Status

    By Russ on December 30, 2013
    Comments Off on Site Status | Filed under: About This Site, Blog | Tags: No Tag
    What I Believe

    By Russ on January 2, 2013
    Comments Off on What I Believe | Filed under: About Me, Politics, Religion | Tags: Lord Devlin”

    I only want what category_in is supposed to return..those above with Filed under : About, not the child categories About Me and About This Site.

    Thanks. Love the plugin and make lots of use of it, but don’t understand what I’m getting wrong here.

    https://wordpress.org/plugins/tpg-get-posts/

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

    (@cswaim)

    I needed to do a little research on the post_type see the format is if there are multiple items, ie page,post then the parameters must be passed as an array. I do not believe the plugin coverts the comma separated values to an array. Making the value invalid.

    If an invalid value is passed into WP_Query, the default is to return 10 posts, which I believe is the behavior you are seeing in the ‘working’ queries.

    I will look into this further and sounds like a good feature to add.

    Post back if the results are consistent if you just say page or post.

    Thread Starter LVRuss

    (@lvruss)

    Thanks for getting back to me so quick. You’re right. That was the problem. Making 2 calls, one for posts, one for page, made everything work. Here’s the actual code block. I’m useing PHP Code for posts plugin to for the code and Post Tags and Categories for Pages plugin to assign categories to pages.

    <?php
    global $post;
    $content = '';
    echo '<p>';
    	echo do_shortcode('[php snippet=1]');
    // snippet 1 displays Signature
    	echo '<hr/>';
    	if (($post->post_title == "Site Status") or ($post->post_parent == "59")){
    // 59 is the ID of the Blog category home page whose title is also Blog. Child pages of page Blog are home pages of Blogging sub-categories.
    // Items in Site Status category and Blog category and Blog sub-categories should be listed in descending date order.
    // Start by getting the pages assigned to the category the current page is the home page for.
    		$content = '<p><b><h3 style="color: #ff0000;">Pages listed in '. $post->post_title . '</h3></b><span style="color: #ff0000;"><em>Most Recent is on Top</em></span><br/>';
    		$content .= '[tpg_get_posts category_in="' .$post->post_title .'" post_type="page"  orderby="date" order="desc" post_status="publish" numberposts=-1 show_excerpt="true" fields="title,byline,metadata"]</p>';
    		echo do_shortcode($content);
    // Follow pages with Blog Posts.
    		$content = '<p><hr/><b><h3 style="color: #ff0000;">Blog Posts listed in '. $post->post_title . '</h3></b><span style="color: #ff0000;"><em>Most Recent is on Top</em></span><br/>';
    		$content .= '[tpg_get_posts category_in="' .$post->post_title .'" post_type="post"  orderby="date" order="desc" post_status="publish" numberposts=-1 show_excerpt="true" fields="title,byline,metadata"]';
    		echo do_shortcode($content);
    	}else{
    // For everything else we want the list to be alphabeical.  First the pages.
    		$content = '<p><b><h3 style="color: #ff0000;">Pages listed in '. $post->post_title . '</h3></b><span style="color: #ff0000;"><em>In Alphabetical Order</em></span><br/>';
    		$content .= '[tpg_get_posts category_in="' . $post->post_title  .'" post_type="page"  orderby="title" order="asc" post_status="publish" numberposts=-1 show_excerpt="true" fields="title,byline,metadata"]';
    		echo do_shortcode($content);
    // Then any Site Status or Blog post
    		$content = '<p><hr/><b><h3 style="color: #ff0000;">Blog Posts listed in '. $post->post_title . '</h3></b><span style="color: #ff0000;"><em>In Alphabetical Order</em></span><br/>';
    		$content .= '[tpg_get_posts category_in="' . $post->post_title  .'" post_type="post"  orderby="title" order="asc"
    post_status="publish" numberposts=-1 show_excerpt="true" fields="title,byline,metadata"]';
    		echo do_shortcode($content);
    	}
    // Last, show any attachments to the page we're on.
    	$content = '<p><hr/><b><h3 style="color: #ff0000;">Attachments to '. $post->post_title . '</h3></b><span style="color: #ff0000;"><em>In Alphabetical Order</em></span><br/>';
    	$content .= '[tpg_get_posts post_type="attachment"  post_parent="' .  $post->ID .'" orderby="title" order="asc" post_status="inherit" numberposts=-1 fields="title,byline,metadata"]';
    	echo do_shortcode($content);
    echo '</p>';
    ?>

    with results at RussPerry.com.

    Thread Starter LVRuss

    (@lvruss)

    category_in is not working again.

    Plugin Author Criss Swaim

    (@cswaim)

    If you updated the base plugin recently, check to make sure the extension has been updated. The extension must be manually updated after the base plugin is updated. Selecting multiple post types is not supported yet, so you must continue to issue two different requests, one for posts and one for pages.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘category_in not working’ is closed to new replies.