Wanting to allow to display multiple CPTs in GFPC widget

Original request:

I also want to allow to display multiple CPT in a widget. I’ve tried the code above but with no success. What should I select in the “Post type” selector in the widget then?

gfpc-widget-d First you will find the correct widget ID. My cases GFPC widget ID is gfpc-widget-4.

Now adding a custom filter for query args. Code will go to functions.php file:

add_filter( 'gfpc_query_args_gfpc-widget-4', 'gd_gfpc_query_args', 10, 2 );
function gd_gfpc_query_args( $qargs, $instance ) {
  $qargs['post_type'] = array( 'post', 'listing' ); //* assign your custom post type  
  return $qargs;

I am showing the posts from “post” & “listing” custom post type. You will edit the array( 'post', 'listing' ) based on your post type.

Also I used “gfpc_query_args_gfpc-widget-4” filter. This filter will only work for “gfpc-widget-4” widget ID. If your widget ID is “gfpc-widget-2” then your filter name will be gfpc_query_args_gfpc-widget-2. This way you can change the default query args.

Share This Article

C. Paul

Creating Genesis Framework related themes, plugins, articles and troubleshooting the issues. Also I am doing the freelance work for clients.

Subscribe Membership Plan ($9.99/mo)

  • Get full access to all premium tutorials
  • Get Support for the posted content
  • Request for specific how-to tutorials
  • Cancel the subscription at anytime

Reader Interactions

11 Discussion to This Post

      • Thomas says

        Yes, I’ve checked it before but I’m not sure. Woud it be :
        $qargs[‘tax_query’] = array ( ‘custom-taxonomy-1’, ‘custom-taxonomy-2’ );


        • Genesis Developer says

          That one is wrong.

          You can try this way:

          $qargs[‘tax_query’] = array(
          ‘taxonomy’ => ‘YOURTAXONOMYNAME’,
          ‘field’ => ‘slug’,
          ‘terms’ => array( ‘custom-taxonomy-1’, ‘custom-taxonomy-2’ ),

          • Thomas Garric says

            I’d like to complexify the output and to filter by a list of tags as well. What should I add to this function?

              • Thomas Garric says

                I’ve tried this but it doesn’t show any content:

                add_filter( ‘gfpc_query_args_gfpc-widget-7’, ‘gd_gfpc_query_args_hf’, 10, 2 );
                function gd_gfpc_query_args_hf( $qargs, $instance ) {
                $qargs[‘tax_query’] = array( ‘tag’ => ‘home-featured, home-featured-it’ );
                return $qargs;

                • Genesis Developer says

                  Can you try this once?

                  add_filter( 'gfpc_query_args_gfpc-widget-7', 'gd_gfpc_query_args_hf', 10, 2 );
                  function gd_gfpc_query_args_hf( $qargs, $instance ) {
                    $qargs['tag'] = 'home-featured,home-featured-it';
                    return $qargs;
  1. Thomas says

    Thanks a lot. And what if I want to filter by category name AND post type in the same filter (in functions.php as well)?

Leave A Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.