[Support request] Exclude a specific category from the side bar post lists in Category Page

Home Forums Support [Support request] Exclude a specific category from the side bar post lists in Category Page

Home Forums Support Exclude a specific category from the side bar post lists in Category Page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1624210
    impro1

    Using Dispatch layout and want to exclude a specific category from the side bar show post lists in the category page. e.g.:
    https://MySite.com/category/styling/

    1. In a Category page, say “Styling”, I want to use the “Sidebar” ShowPost List that came with Dispatch layout, but I don’t want to show the Posts for “Styling” Category. Basically, filter out the posts for current Category in this pages.
    I want the same functionality in other Category pages. E.g. The “Time Saving” will show the posts from other categories except “Time Saving” Category. Please see the attached Screenshot.

    View post on imgur.com

    2. Also I have issues with adding a new Sidebar2 ShowPost list (identical to “Sidebar” List , like a clone). The posts do not display (render) but the HTML shows that the markup ( like the H2 post title etc. is generated when I view source!
    Do I have to use special CSS to display any new Show post list in side bar?

    #1624278
    Elvin
    Staff
    Customer Support

    Hi,

    For #1:

    Go to Appearance > Widgets and check for the list ID of the WPSP list added to the sidebar.

    You then go to Dashboard > Posts List. There should be a list of post lists.

    Find the WPSP list that has been added to the sidebar and edit it.

    You should find a UI of something like this: https://share.getcloudapp.com/4guOoejl

    Set the dropdown to “Category” and check all the categories of posts you want to display for the WPSP list you’re editing.

    For #2:

    I’m not exactly sure what’s happening here.

    Can you link us to the page in question to check? You can use the private information text field to provide the site details. Thank you.

    #1624346
    impro1

    Thanks for the quick response!
    I am trying this Taxonomy setting to exclude the category that I don’t want to display in a category page.
    So, I have like 7 categories, so I have to create 7 Show post list for the sidebar. Wish I could have a filter or drop down in the Widget setting where I could have selected on which Category to exclude for a generic ONE Show post list.

    For #2 see the Home page bottom list. Link is in private info

    #1624367
    Elvin
    Staff
    Customer Support

    So, I have like 7 categories, so I have to create 7 Show post list for the sidebar. Wish I could have a filter or drop down in the Widget setting where I could have selected on which Category to exclude for a generic ONE Show post list.

    I’m not sure I fully understand what you mean.

    You can simply use 1 one post list and just uncheck the categories you don’t want displayed.

    But of course, if you want to display 1 post for each category then what you’re currently doing is the way to go.

    If you want a list that has a dropdown AJAX filter that dynamically changes what’s displayed, I’m afraid you may have to look for a plugin that does that as WP Show Posts does not have this feature.

    I am trying this Taxonomy setting to exclude the category that I don’t want to display in a category page.

    WP Show Post doesn’t have a conditional setting that excludes things when you’re on a category archive page within its UI. But you should be able to do something about it with wpsp_query_args.

    You can style the h2 text within “More Articles – Using Dispatch Default Show Post Simple” by adding this CSS:

    section#wpsp-1471 article.wp-show-posts-single .wpsp-content-wrap header.wp-show-posts-entry-header .wp-show-posts-entry-title a {
        color: white !important;
    }

    For the overlay for text:

    #wpsp-1471 .wp-show-posts-entry-title {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        position: absolute;
        z-index: 99;
        bottom: 60%;
        left: 0;
        background: rgb(0, 0, 0);
        background: rgba(0,0,0,.7);
        width: 100%;
    }

    Basically, we need to specify #wpsp-1471 or section#wpsp-1471 where 1471 is the ID of the WPSP list we want the CSS to apply to.

    #1624879
    impro1

    Thanks for all the suggestions, and I will try out the CSS.
    As for excluding a category from a WSP list, is there any parameter/arguments that can be used in the short code? e.g.:

    [wp_show_posts id="1471" category="-Styling"] OR [wp_show_posts id="1471" ExcludeCategory="Styling"]
    This will be displayed in a sidebar in Category Page of “Styling” but exclude any posts from “Styling” category.

    Not sure how to use wpsp_query_args you suggested.

    #1625625
    Elvin
    Staff
    Customer Support

    Not sure how to use wpsp_query_args you suggested.

    This is how that filter is used:

    add_filter( 'wpsp_query_args', function( $query, $settings ) {
        if ( 1471 === (int) $settings['list_id'] ) {
             $query->set( 'cat', '-22, -21' );
        }
        return $query;
    }, 10, 2 );

    You can even add in more conditions to check if you’re on a certain post or page. -22 and -21 are category IDs. 1471 is the WPSP list id.

    But if you’re not doing any conditional checks for pages, you can just do this with the UI.

    For example: https://share.getcloudapp.com/04uNpWBQ

    This screenshot of a WPSP setting doesn’t include posts from “Uncategorized” and “Politics” categories as they are unchecked.

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