Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1168007
    andrewteg
    Participant

    We have author pages such as http://northstarfamily.org/author/jeff-noble/ and were able to add a blurb at the top with some help of the forum and using an action in our functions.php file.

    However, I’d like to also have that page not show any posts that are categorized as News (slug=news, id=17) since our News postings are usually just random and not author specific.

    1) Is it possible to add something to filter out that category? If so, where?

    2) If that is beyond the scope of what you can do here, can you tell me how to create a new author index page in my child theme that I can customize? I believe from other themes I need to find the loop and look for and change query_posts and the_post like this:
    <?php query_posts($query_string . 'cat=-92'); while ( have_posts() ) : the_post(); ?>
    However, I’m not sure where that is in X since I’ve only modified a few child theme files and wp-index.php in framework/views/integrity/ does not have query_posts or the_post() inside.

    Thanks,
    Andrew

    #1168595
    Rad
    Moderator

    Hi Andrew,

    Thanks for writing in.

    Please add this code to your child theme’s functions.php

    function exclude_some_category( $query ) {
        if ( $query->is_author() && $query->is_main_query() ) {
            $query->set( 'cat', '-92' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_some_category' );

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1168007 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>