WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Filtering Pods (3 posts)

  1. Archie22is
    Member
    Posted 1 year ago #

    Hi guys,

    I setup my list of content types using Scott and team's Pods Framework. You can enter a Pods post type and link into to a custom taxonomy without any issues. Everything works 100% however I have the following issues. I want to filter certain custom post per taxonomy (per page), i.e: Education posts must only display on http://www.example.com/education

    I can't seem to get that right since the var_dump($loop) only display the following:

    public 'posts' =>
        array (size=12)
          0 =>
            object(stdClass)[317]
              public 'ID' => int 903
              public 'post_author' => string '3' (length=1)
              public 'post_date' => string '2012-11-26 14:47:28' (length=19)
              public 'post_date_gmt' => string '2012-11-26 12:47:28' (length=19)
              public 'post_content' => string '' (length=0)
              public 'post_title' => string 'Test' (length=4)
              public 'post_excerpt' => string '' (length=0)
              public 'post_status' => string 'publish' (length=7)
              public 'comment_status' => string 'closed' (length=6)
              public 'ping_status' => string 'closed' (length=6)
              public 'post_password' => string '' (length=0)
              public 'post_name' => string 'test' (length=4)
              public 'to_ping' => string '' (length=0)
              public 'pinged' => string '' (length=0)
              public 'post_modified' => string '2012-11-27 09:14:27' (length=19)
              public 'post_modified_gmt' => string '2012-11-27 07:14:27' (length=19)
              public 'post_content_filtered' => string '' (length=0)
              public 'post_parent' => int 0
              public 'guid' => string 'http://localhost/Traderzone/?post_type=company_listing&p=903' (length=65)
              public 'menu_order' => int 0
              public 'post_type' => string 'company_listing' (length=15)
              public 'post_mime_type' => string '' (length=0)
              public 'comment_count' => string '0' (length=1)
              public 'filter' => string 'raw' (length=3)

    In this case, how will I get to choose the selected taxonomy value to filter with? I tried the following method and it returned zero results:

    $my_query = new WP_Query(array(
    		      		'post_type' => 'company_listing',
    		      		//'tag_id' => 39,
    					'category_name'  => get_post_meta($post->ID, 'service_category', true),
    					'posts_per_page' => 10000,
    				));
  2. Scott Kingsley Clark
    Member
    Posted 1 year ago #

    Try the WP_Query 'tax_query' and use get_post_meta($post->ID, 'service_category.term_id', true) for the ID array

  3. Archie22is
    Member
    Posted 1 year ago #

    Thank you Scott!!

    #Resolved

Topic Closed

This topic has been closed to new replies.

About this Topic