Support » Plugins » Hacks » Exclude category from homepage ticker pagination

  • Hi all, i have created a blog,

    First of all, the blog is structured that when i publish a article in the category “Comunicati” (ID=2), automatically the article is showed in the ticker-news in the home, above the sliders, but is itself excluded from the recents post in the home and is viewed only in the menu category “Comunicati”.

    At first, when i inserted the code in the function.php:

    ‘function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set(‘cat’, ‘-2’);
    return $query;
    add_filter(‘pre_get_posts’, ‘exclude_category’); ‘

    the posts were excluded from showing in the home, but that affected as well the news-ticker, then i restored function.php and then i reinserted the above code in the header.php inside the code of the news-ticker:

    ‘<?php if ( function_exists(‘insert_newsticker’) ) { insert_newsticker(); }

    function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set(‘cat’, ‘-2’);
    return $query;
    add_filter(‘pre_get_posts’, ‘exclude_category’);

    ?> ‘

    And that is perfect. Now all the posts published under the category “Comunicati” is only displayed in the news-ticker in the home and in the menu category “Comunicati”.

    Now i have two problems. Not all the posts under “Comunicati” must be viewed in the news-ticker in the home and the menu “Comunicati” of the site, but sometimes, when the article is important, i want that posted in home too, in the recents post, along with the news-ticker and the archive-menu. A solution is to publish it with two categories, one of these is “Comunicati” (because if not, the news-ticker doesn’t view nothing) and other for instance under category “Importanti”.
    The problem is that change nothing. The post won’t view on the home. How i can add these in the home when i publish under the category “comunicati” and other category? When i add other category than “comunicati”, the post has to be viewed in 1)news ticker, 2)category “comunicati” in the menu and 3) in the recents post of home.

    The second problem is that i want to enable the included pagination of the theme in my homepage that show recent articles. And i archived that adding the function present in the theme “journal crunch”:

    ‘<div style=”clear:both;”></div>
    <?php if (function_exists(“emm_paginate”)) {
    } ?>
    </div> ‘

    in the file: home.php

    but that function doesn’t care about exclusion of the category. It’s viewing all the articles includind “Comunicati” and i don’t want that.
    How can i resolve this?

    I hope you can help me. Thanks.

  • The topic ‘Exclude category from homepage ticker pagination’ is closed to new replies.