[Resolved] Begin with One Category

Home Forums Support [Resolved] Begin with One Category

Home Forums Support Begin with One Category

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #585915
    Tom

    I am trying to begin a blog at http://ethericstudies.org/opinion/ that will only display articles written in Category:opinion. I am using the Blog plugin that is bundled with the Pro version of the GeneratePress template. I am also using Snippit and Simple CSS.

    My challenged thus far is to restrict the display to just articles in the opinion category. Right now it shows everything.

    I found a bit of code in one of the other posts:
    function generate_dequeue_scripts() {

    // If the category ID is 20, dequeue masonry
    if ( is_category( ’20’ ) ) :
    wp_dequeue_script( ‘blog-scripts’ );
    wp_dequeue_script( ‘jquery-masonry’ );
    wp_dequeue_script( ‘blog-imagesloaded’ );
    wp_dequeue_style( ‘blog-styles’ );
    endif;

    }
    add_action( ‘wp_print_scripts’, ‘generate_dequeue_scripts’, 100 );
    add_action( ‘wp_enqueue_scripts’, ‘generate_dequeue_scripts’, 100 );

    (My opinion category is “20.”)

    I also incorporated:
    .category-20 .page-header,
    .category-20 .inside-article {
    margin-right: 0;
    }

    The code made no difference.

    Any idea how I can limit the display to one category?

    GP Premium 1.6.2
    #585947
    Leo
    Staff
    Customer Support
    #586412
    Tom

    Thanks for the response Leo.

    I placed this from that other post:

    function generate_opinion_category( $query ) {
    if ( $query->is_opinion() && $query->is_main_query() ) {
    $query->set( ‘category_name’, ‘opinion-category-slug’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘generate_opinion_category’ );

    I changed it from “home” to “opinion. When it was still “home”, the page showed “Nothing Found.” When I changed it to “opinion,” the page showed as before with the opinion category first and then everything else.

    Perhaps the code needs to be changed to limit the display to “opinion.” Right now, it is displaying as if “opinion” is just a priority.

    #586461
    Leo
    Staff
    Customer Support

    Might be easier to just use Tom’s WP Show Posts: https://en-ca.wordpress.org/plugins/wp-show-posts/

    It’s design for this purpose ๐Ÿ™‚

    #586600
    Tom

    I see references to that WP Show Post here and there on the board but could not figure out how to configure it to display only one category.

    Can you tell me where to access that control?

    #586707
    Leo
    Staff
    Customer Support

    Try creating a new list, then in Posts tab select Taxonomy > category.

    #587240
    Tom

    Thanks Leo! That worked. I had already tried that plugin and did not see the Taxonomy list arrow. I deleted the old try and set up a new one and it did show the list arrow and the plugin worked fine.

    With that said, I went back and tried just the plugin that is bundled with the premium and it also worked with only the intended category. I have to assume it is operator error.

    The difference in display is that the bundled version does not show the sidebar which is okay. It does feature the newest entry across two columns. That is a nice touch. So I am going to mark this as resolved. Thanks for the help.

    PS: I think the reason the bundled plugin worked is that I went to the category page first. The way I have it set up now that works, but there are so many different variations I am still trying to figure out what I am doing. If I can’t figure it out, I will initiate a new ask for help.

    #587343
    Tom

    Okay, so I found that using Settings > Reading > and selecting any Blog page as the Post Page supersedes all other commands. Returning that setting to “Select” will allow the “WP Show Posts” to function as advertised. I am all set, thank you.

    #587377
    Leo
    Staff
    Customer Support

    Glad you figured out ๐Ÿ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.