Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 170

Home Forums Theme Support Cassiopeia Hiding a category from the loop on the blog page


Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658

Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3221

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
    generation10
    Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109

    Hello again,

    I’m trying to hide the posts from a certain category from the blog page it kinda works but the title of the blog page is now the title of the last post from the category that I’m hiding.

    I’m using the following code to hide the posts from the blog page.

    <?php query_posts($query_string . '&cat=-5'); ?>

    Thanks for your time 🙂

    #3239

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
    skat
    Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109

    Hi there,

    Are you trying to do this on the blog page? If so, try instead of your query to change the default query, this:

    $wp_query->query('showposts='.$data['number_blogposts'].''.'&paged='.$paged);

    to this:

    $wp_query->query('cat=-5'&showposts='.$data['number_blogposts'].''.'&paged='.$paged);

    Cheers!
    Chris

    #3245

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
    generation10
    Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109

    I’m trying it on the index page but I can try to make it work on the blog page.

    Thanks

    Edit: I tried and got an nasty division by zero error 🙁

    #3274

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657

    Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658

    Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
    generation10
    Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109

    Hi there,

    I managed to fix it using the following code:

    <?php
    function excludeCat($query) {
      if ( $query->is_home ) {
        $query->set('cat', '-21');
      }
      return $query;
    }
    add_filter('pre_get_posts', 'excludeCat');
    ?>

    Where 21 is the category that I want to hide.

    Cheers 😀

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.