• Resolved chrisesch

    (@chrisesch)


    Hi there,

    how can I exclude a category from “category list block”?

    I don’t want that blogs with the category “uncategorized” are displayd with the “category list block”. They should be unvisible.

    Chris

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Hi @chrisesch – there isn’t a built-in setting to exclude categories from the Category List block, which is a core WordPress block rather than something specific to Twenty Twenty-Three.

    That said, each category in the list has a unique CSS class, which means that it would be possible to hide it with some custom CSS code, as a little workaround. Let me know if you’d be interested in this approach, and if possible, could you please provide a link to a page on your site where I can see the category block in action, so I can provide you with the most accurate CSS code. Thanks!

    Thread Starter chrisesch

    (@chrisesch)

    Thank you @zoonini,

    no sorry I can’t provide you with a url because the site is still not published it’s under construction.

    I thought I found a solution with the “ulitimate category excluder” plugin. In its setting I can exclude the “uncategorized” category. But unfortunatly only the listed number of blog posts with this category disapear from the list and not the category name it self.

    If there is a little bit of code which can exclude the name of the unwanted “uncategorized” category I would be happy if you can support me with it ??

    Chris

    Moderator Kathryn Presner

    (@zoonini)

    @chrisesch

    If there is a little bit of code which can exclude the name of the unwanted “uncategorized” category I would be happy if you can support me with it

    Sure, give this a try:

    /* Uncategorized category in Category List block */ 
    .wp-block-categories-list .cat-item-1 {
      display: none;
    }

    This assumes your Uncategorized category has the ID of 1 – you can double-check that in your browser inspector, as you see here:

    Self hosted Test and untitled

    While the CSS editor is hidden by default when a block theme like Twenty Twenty-Three is active, you can still access it by adding /wp-admin/customize.php after your URL, and heading to the Additional CSS panel.

    Let me know how it goes!

    Thread Starter chrisesch

    (@chrisesch)

    Thank you so mutch for your kind support @zoonini !!

    I add your piece of code via “SiteOrigin CSS” plugin to my site.

    And it works half the way ?? If I preview my category list after inserting this customized css as an orderd list the “uncategorized” category is not listed anymore, great ?? But activated as a “drop down list” the uncategorized is still there …

    So I guess the id is right but something else for the drop down menu is missing.

    I made a screenshot of this phenomen, unfortunately I can’t add it to this message, or am I overlooking something?

    Moderator Kathryn Presner

    (@zoonini)

    @chrisesch Thanks for clarifying that you’re using the dropdown version of the block. ?? We’d just need to adjust the CSS a little in that case:

    /* Uncategorized category in Category List block - dropdown */ 
    .wp-block-categories-dropdown option[value="1"] {
      display: none;
    }

    Let me know how it goes!

    I made a screenshot of this phenomen, unfortunately I can’t add it to this message, or am I overlooking something?

    I don’t think I need to see your screenshot, but for the future, you can either use a tool like https://snipboard.io and paste the generated link here, or use your preferred tool and upload the image to your Media Library. Then, insert an Image block here and paste your Media Library URL into the block.

    Thread Starter chrisesch

    (@chrisesch)

    Thnx again!

    Unfortunately the “uncategorized” category keeps visible. Please note these screenshots:

    https://snipboard.io/deuFqQ.jpg

    https://snipboard.io/PQXUDu.jpg

    https://snipboard.io/PQXUDu.jpg

    Moderator Kathryn Presner

    (@zoonini)

    Hey there @chrisesch ! Looks like your third-party CSS editor is incorrectly converting the [ character to an HTML entity, which is breaking the code. ??

    Could you try the built-in core CSS editor instead and let me know how that goes? If it works, then you can let the SiteOrigin CSS people know about the glitch in their editor. ??

    Thread Starter chrisesch

    (@chrisesch)

    Thats funny … i will try to add the css directly to ?customize.php“

    Moderator Kathryn Presner

    (@zoonini)

    Let me know how it goes!

    Thread Starter chrisesch

    (@chrisesch)

    Hi @zoonini,

    all works fine now:-)

    The fault was caused by MacOs Mail. I copied the 2nd piece of code from mail preview and not from this support page. So SiteOrigin CSS was not the reason for breaking the code.

    Thnx!
    Chris

    Moderator Kathryn Presner

    (@zoonini)

    Glad you figured that out! I’ll mark this thread as resolved but feel free to open a new one if you have other questions.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘how to exclude a category from category list block’ is closed to new replies.