WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing some catagories from the fromtpage (7 posts)

  1. jthusgaard
    Member
    Posted 8 years ago #

    Hi

    I need to remove 2 catagories from the frontpage of my site (www.fuldmaegtigforeningen.dk) I have sucessfully removed one catagory from the frontpage and need to remove one more. How do I do that?

    So far I have used: <?php
    if ((empty($_GET['cat']))&&(!preg_match('/wp-admin/', $_SERVER['REQUEST_URI']))) $cat = '-1';
    ?>

    Adding another cat number to the list does not help, så how do I do this when I want to remove cat 1 & 5 from my frontpage?

    J;-)

  2. tomhanna
    Member
    Posted 8 years ago #

    Depends what Template Tag you are using to call the category list.

    http://codex.wordpress.org/Template_Tags

    If you're using wp_list_cats you'd do something like this:

    <ul>
    <?php wp_list_cats('sort_column=name&optioncount=1&exclude=10, 15'); ?>
    </ul>

    where the numbers in "exclude=10,15" are the numerical categories you want to exclude.

    http://codex.wordpress.org/Template_Tags/wp_list_cats

  3. jthusgaard
    Member
    Posted 8 years ago #

    How do I know what template tags I'm using to call the catagory list?

    I want the catagories to be listet (in the colum on the left) but just not to have them listed in the field where the pages go.

    J;-)

  4. ifelse
    Member
    Posted 8 years ago #

    If I understand what you're trying to say, you wish to exclude posts that belong to either one of the two specified category (and not exclude the display of the category links as Tom inferred).

    If that is the case, then unfortunately the short answer is that you can't due to the way the underlying SQL used for excluding/including categories was written in WP. To do the same, you'll either have to
    a) use a single category (i.e. called exclude) and attach posts from both categories to it
    b) or carry out the effect of excluding multiple categories by including every other category but those two i.e. $cat = '2,3,4,6';

  5. jthusgaard
    Member
    Posted 8 years ago #

    How do I go about doing any of the two solutions that you suggest!

    How come I can not use the hack I'm already using, in an extended version, It only works on one catagory:

    <?php
    if ((empty($_GET['cat']))&&(!preg_match('/wp-admin/', $_SERVER['REQUEST_URI']))) $cat = '-1';
    ?>

    J;-)

  6. jwurster
    Member
    Posted 8 years ago #

    I use a plugin called category-levels from http://www.coppit.org/code/. I think it should do what you want.

  7. jthusgaard
    Member
    Posted 7 years ago #

    I'm using the catagory visibility plugin, that can be found here: http://ryowebsite.com/?p=46

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.