WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Exclude categories from results but don't exclude widget

[Resolved] Exclude categories from results but don't exclude widget

  • Hi, love your plugin, it does exactly what it says and it looks great too!

    I have a couple of questions.

    1. I have used the ‘exclude these categories’ setting to filter out the categories that I don’t want showing up in the results. The only thing is, I actually want related posts to show up while a user is in a post in that category. For instance, I repost our newsletters in our blog but I don’t want them showing up in the widget results but I want the users to be able to see related posts anyway from other categories). Can this be done?
    2. Is there a way of displaying related posts in the archive pages too?

    http://wordpress.org/extend/plugins/related-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey Tami, sorry for the late reply!

    1. I’m afraid this is not possible. The exclusion works both ways — the related posts don’t show up in those excluded categories and those posts from the excluded category don’t get recommended elsewhere on your blog as well. I’m really sorry about that!

    2. Yes, there is, but it depends on what WP theme you are using. The main thing is, you’ll have to enter the following code in the right place:

    <?php wp_related_posts()?>

    If you are using the TwentyTwelve or TwentyEleven theme, go to the tab ‘Appearance’-‘Editor’ (in your WP Dashboard), click on the archive.php file, and enter that code after the following lines:

    /* Include the post format-specific template for the content. If you want to
    				 * this in a child theme then include a file called called content-___.php
    				 * (where ___ is the post format) and that will be used instead.
    				 */
    				get_template_part( 'content', get_post_format() );

    So now it should look something like this:

    /* Include the post format-specific template for the content. If you want to
    				 * this in a child theme then include a file called called content-___.php
    				 * (where ___ is the post format) and that will be used instead.
    				 */
    				get_template_part( 'content', get_post_format() );
    				<?php wp_related_posts()?>

    Let me know if this helped you in any way or if you need any additional assistance — I’ll gladly help!

    Take care & have a nice weekend!

    Best,
    Silvo

    Thanks for your help Silvo. I actually use the genesis theme and I managed to get it showing in the sidebar by using the simple hooks plugin.

    Much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Exclude categories from results but don't exclude widget’ is closed to new replies.