• Resolved unalignedcoder

    (@unalignedcoder)


    I use this plugin to display my aside posts in the sidebar. They all belong to the same category, so I’m just using the slug to retrieve them with Posts in sidebar.

    Now the problem is that if the user navigates to the category page, he will find the same posts in the page and in the sidebar. I couldn’t find an option to avoid this… is there any workaround?

Viewing 1 replies (of 1 total)
  • Plugin Author Aldo Latino

    (@aldolat)

    You can use the “Widget Logic” plugin to specify when a widget is shown or hidden. With this plugin installed and active, you setup two identical widget of Posts in Sidebar with the only difference that the second must skip the number of posts that the archive page is showing.

    Let me explain.

    1. Install the plugin from your dashboard. Search for Widget Logic, install and activate it.

    2. Go to the widget page and create a perfect clone of the widget that is showing your asides posts. Create it just under the existing one.

    3. In the previous existing widget, you will find a field “Widget logic” at the bottom of it. In the field paste this line

    
    !is_category('my-category')
    

    Change my-category with the correct slug of your category.
    The line will hide (notice the !) this widget only in the “My Category” category page.

    4. In the newly created widget, go to the “Getting posts” panel > “Skip this number of posts” field and write the number of posts your archive page shows. If your blog displays 10 posts per page, write 10.

    5. In the newly created widget, go to “Widget Logic” field, just at the bottom of the widget and paste this line:

    
    is_category('my-category')
    

    Change my-category with the correct slug of your category.
    The line will make the widget appear only in the “My Category” category page.

    Save all the widgets and test the results.

    Let me know, please.

    Note. Take a look at this Codex Page where you can find all the conditional tags you can use with Widget Logic.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide posts on category page’ is closed to new replies.