WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Exclude categories from widget drop-down menu (10 posts)

  1. ryanandrewsimmons
    Member
    Posted 2 years ago #

    Hi,

    Does anybody know how I go about excluding specific categories from the widget drop-down menu that I put on my site's sidebar? I want certain categories to not appear on that list. I can't figure out how to do it. All the directions I found online are for older versions of WordPress and I couldn't get them to work.

    Do I have to do this through FTP? Or can I do this by modifying the PHP of my template on WordPress itself?

    While we are on the subject, I also want to exclude certain categories from the "Posted In" footer at the bottom of each post. I know what section of code I need to modify in order to do this (in the loop.php file), but I don't know exactly how to go about doing so.

    (I am a bit of a n00b at this, so I apologize if these are really simple problems).

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Does anybody know how I go about excluding specific categories from the widget drop-down menu that I put on my site's sidebar?

    There isn't an option to exclude any categories when using the default Categories widget in Appearance->Widgets. You might be better off using wp_list_categories instead.

  3. ryanandrewsimmons
    Member
    Posted 2 years ago #

    I should have been more clear. I understand I can't do it through the default options. That's why I asked,

    "Do I have to do this through FTP? Or can I do this by modifying the PHP of my template on WordPress itself?"

    I read that page, and I understand the code, I just don't understand WHERE I go to make these changes. So the code I want is,

      <?php wp_list_categories('orderby=name&include=3,5,9,16'); ?>

    Where do I put this? I looked through all of the Template Tag instructions but they are very vague about this point.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    o I have to do this through FTP? Or can I do this by modifying the PHP of my template on WordPress itself?

    You can either modify the relevant theme template file via Appearance->Editor. Or download it using FTP & modify it in a plain text editor. The latter is probably safer.

    Where do I put this?

    There's no way to answer that than to say - wherever you want this list of categories to appear.

  5. ryanandrewsimmons
    Member
    Posted 2 years ago #

    I want to put it on the sidebar, like the widget.

    Which .php file do I need to edit? Theme.php? Loop.php? More than one?

    Do you know what part of the code relates to the sidebar specifically?

    Sorry to keep badgering you, but again, I'm new.

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    sidebar.php?

  7. jnhghy
    Member
    Posted 2 years ago #

    Hi, you can use a php-widget plugin, that will enable you to put php code in a sidebar widget that will list your categories.You can try this widget plugin.

  8. ryanandrewsimmons
    Member
    Posted 2 years ago #

    Thanks, esmi. Your solution worked perfectly!

  9. linkfr
    Member
    Posted 1 year ago #

    Hi, i'd like to do the same (exclude a category from the default dropdown category widget).

    As far as i see, i gotta modify sidebar.php

    But what excactly should i add (code)? And where?

    And if i modify that file then all blogs in network will be modified?

  10. alchymyth
    Forum Moderator
    Posted 1 year ago #

    @linkfr

    per forum rules, please start your own topic

    if you are using 'multisite', please start a topic in http://wordpress.org/support/forum/multisite#postform

Topic Closed

This topic has been closed to new replies.

About this Topic