logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$20
Lotus WP theme - exclude category from Blog Page

I am using the Lotus WP theme:

http://themeforest.net/item/lotus-for-business-software-corporate-portfolio/164748

And I need to exclude a category from showing on the blog page of my site.

As this is a custom theme, it doesn't adhere well to all of the 'fixes' on the internet. It's got it's own blog php file, so it's not your typical WP install (just so we're clear ;) ).

It's also not fixable by a plugin (as far as I know.. but I've tried a lot). The developer confirmed this to me and suggested that I come here for answers. I need to exclude category 16 from the page so please help me out. :)

I've attached the blog php files in the event that someone wants to look at them. Thanks in advance!

This question has been answered.

attachment image View Attachment

mvancleve | 07/19/12 at 1:59pm Edit


(5) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    07/19/12
    2:05pm
    Michael Caputo says:

    You need to include:

    &cat=-IDNUMBEROFCATEGORY


    in your query string.

    Previous versions of this answer: 07/19/12 at 2:05pm

  • avatar
    Last edited:
    07/19/12
    2:07pm
    Francisco Javier Carazo Gil says:

    In blog.php look for $query_string ="post_type=post&paged=$paged"; in line 160 and change it with:

    $query_string ="post_type=post&paged=$paged&cat=-16";

    That's all.

    • 07/19/12 2:26pm

      mvancleve says:

      Worked like a charm!

    • 07/19/12 2:27pm

      Francisco Javier Carazo Gil says:

      Perfect, vote me please :)

    • 07/19/12 2:32pm

      mvancleve says:

      I tried, but it says:

      3 groups of people are allowed to vote:
      The true elite who've earned 1% of all winnings on the site.
      The top monthly experts.
      The admins of this site.
      All votes are public.

      If you have already voted, you can not vote again.

      Once an answer receives more downvotes than upvotes, then it is no longer displayed on the question page.

      You are not allowed to vote.

    • 07/19/12 2:34pm

      Francisco Javier Carazo Gil says:

      I never have asked before but I thought that asker could vote. Look at something like question solved, I don't know exactly.

  • avatar
    Last edited:
    07/19/12
    2:08pm
    Arnav Joy says:

    in blog.php

    find the line no.168

    query_posts($query_string);

    replace it from

    $query_string.= '&cat=-'.$cat_id;

    query_posts($query_string);

    where $cat_id is the id of the category you want to exclude

  • avatar
    Last edited:
    07/19/12
    2:11pm
    Dan | gteh says:

    Im banking on the fact that there is an setting in the Options Panel for the theme that lets you exclude categories because of this:


    query_string.= '&cat=-'.$cat_id;


    $cat_id would have to come from somewhere

    • 07/19/12 2:20pm

      mvancleve says:

      Theres not :( confirmed by the developer

  • avatar
    Last edited:
    07/19/12
    2:26pm
    Dbranes says:

    try this filter in blog.php



    function exclude_category($query) {
    //if (is_page('blog')) {
    $query->set('cat', '-16');
    //}
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');


    where 16 is the category_id to exclude and 'blog' is the name of your page where the exclude is to take place.


    Previous versions of this answer: 07/19/12 at 2:18pm | 07/19/12 at 2:26pm

This question has expired.



Gabriel Reguly, Hai Bui, Arnav Joy, Manoj Raj, mvancleve voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.