• Resolved momitza

    (@momitza)


    Let me start with my coding experience : Low :))

    With few video made by you I recently resolved how to let me users to post on my blog with pods but I have 2 problems:

    1. The pod posts are not showing on my first page blog like the WP posts.
    2. The pod posts also not showing in Sidebar of my blog at Recent Posts.

    Thank you !

    Ps: Sorry for my english but is not my first language.

    • This topic was modified 6 years, 1 month ago by momitza.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter momitza

    (@momitza)

    I changed the post type in my theme functions.php but still nothing. Nobody here to help me please.

    add_action( ‘pre_get_posts’, function ( $q )
    {
    if ( !is_admin() // Only target front end queries
    && $q->is_main_query() // Only target the main query
    && $q->is_category() // Only target category archives
    && $q->is_tag() // Only target tag archives
    ) {
    $q->set( ‘post_type’, [‘post’, ‘your_story’, ‘stories’, ‘yourstory’] ); // Change ‘custom_post_type’ to YOUR Custom Post Type
    // You can add multiple CPT’s separated by comma’s
    }
    });

    This is the change I made.. I don’t know what other changes to do…

    Plugin Contributor Jim True

    (@jimtrue)

    You brought this to our Slack Chat, and the finalized function we came up with was the following:

    
    add_action( ‘pre_get_posts’, function ( $q )
    {
      if ( !is_admin() // Only target front end queries
         && $q->is_main_query() // Only target the main query
         && $q->is_home() // target blog posts from home ONLY
         ) {
           $q->set( ‘post_type’, [‘post’, ‘your_story’] ); 
           // Change ‘custom_post_type’ to YOUR Custom Post Type
           // You can add multiple CPT’s separated by comma’s
           }
    });
    

    This is from our doc page:
    https://docs.pods.io/code-snippets/modifying-pre_get_posts-categories-tags-show-custom-post-types/

    On that page, you have to remove the is_category and is_tag if this doesn’t apply to those kind of searches.

    Glad we were able to help you out!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pod posts /recent pod posts problems’ is closed to new replies.