Build Your Own Business Website header image

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

Avatar
Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Excluding categories from the category archive dropdown widget
Avatar
Amanda Atwood
Member
Members
Forum Posts: 20
Member Since:
February 17, 2014
sp_UserOfflineSmall Offline
1
May 12, 2014 - 2:14 am
sp_Permalink sp_Print

Hello Rick

I am hoping you could help me with something. I’ve used the standard Categories widget to display a drop down list of categories on the sidebar of our new site. However, I would like certain categories not to display in this list.

I can see from reading around a bit that there should be a way to advise wp_dropdown_categories to exclude certain categories, but I’m not too sure in which file to find this function. I am using Wordpress 3.8.3 + Thesis 2.1.

Please could you help me find where this function would be, and / or advise any better way to be able to instruct the category archive dropdown to exclude certain categories?

Many thanks,
Amanda

Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
2
May 12, 2014 - 3:44 am
sp_Permalink sp_Print

Don't think there is a totally simple way but this may work:

<?php
function exclude_widget_categories($args){
$exclude = "3,6,18"; // The IDs of the excluding categories
$args["exclude"] = $exclude;
return $args;
}
add_filter("widget_categories_args","exclude_widget_categories");
?>

 

Add to functions.php

Keith

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Avatar
Amanda Atwood
Member
Members
Forum Posts: 20
Member Since:
February 17, 2014
sp_UserOfflineSmall Offline
3
May 12, 2014 - 4:24 am
sp_Permalink sp_Print sp_EditHistory

Hello Keith

Thanks so much! I’ll give that a bash. When I go to functions.php in wp-content/themes/thesis/functions.php it says “// WARNING: Unless you just LOVE problems, DO NOT EDIT THIS FILE!” which is pretty off putting! – Is there somewhere else I should try to insert this PHP?

I’ve researched a bit more, and it seems like if I could get the category dropdown list to point to my categories as words not by ID number, they would display correctly and I wouldn’t have to exclude them anyway – So for example if one would point to the jobs category as a URL structure with words rather than via ID number

As the former displays this material in the “correct” format for our visitors.

So I guess my next question is – Would you know how to instruct the category dropdown to point the user to the URL in words rather than via the ?cat= structure?

Thanks!
Amanda

Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
4
May 12, 2014 - 4:32 am
sp_Permalink sp_Print

Amanda

I should probably have given you a warning about changing that file, which can cause problems if you get it wrong.

What I would do is ftp the file down and save a copy of the original.

Then add the code and ftp it back then make sure that your site works.

If there is a problem don't worry all you have to do is ftp the original file back up and that will solve it.

Not sure about your other question without some research.

Keith

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
5
May 12, 2014 - 4:36 am
sp_Permalink sp_Print

Actually hold on this, I need to check that is the right file to add the code to.

Keith

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
6
May 12, 2014 - 4:41 am
sp_Permalink sp_Print sp_EditHistory

That is the wrong file I gave you:

 

Custom functions

Insert the PHP via a custom.php file (in your active Skin directory) or your master.php file (in /wp-content/thesis).

The functions.php file which is located in the Thesis theme folder is part of the default code, and thus, will be overwritten during upgrades.

So, you should not be editing that file at all -- if you want employ custom PHP code to your site, then it should be added to either the master.php file (which applies to all skins) or custom.php (which is skin-specific) -- both of these files are stored within /wp-content/thesis instead of the main Thesis theme folder, which protects them during upgrades.

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Avatar
Amanda Atwood
Member
Members
Forum Posts: 20
Member Since:
February 17, 2014
sp_UserOfflineSmall Offline
7
May 12, 2014 - 5:38 am
sp_Permalink sp_Print

Hello Keith

That is really helpful, thank you.

Regarding the redirects, whilst I couldn’t make them work via my htaccess file, I have been able to use the Quick Page/Post Redirect Plugin to accomplish the pointing from category numbers to words.

Many thanks for your help,
Amanda

Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
8
May 12, 2014 - 5:51 am
sp_Permalink sp_Print

Good to hear that you are sorted. smile

Keith

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
9
May 12, 2014 - 12:15 pm
sp_Permalink sp_Print

One other solution is to use the Widgets Reloaded plugin.  It substitutes a category widget that allows you to exclude categories.

Avatar
Amanda Atwood
Member
Members
Forum Posts: 20
Member Since:
February 17, 2014
sp_UserOfflineSmall Offline
10
May 12, 2014 - 10:52 pm
sp_Permalink sp_Print

Thanks, Rick

Yes, I had seen mention of the widgets reloaded plugin on your site. I was a little bit wary of it as it had only been last updated in October 2013, and Word Press said it was compatible only to v 3.7.1

I tried it anyway, and it actually seemed to work fine with 3.8.3, but in the end I preferred not to use it as it over wrote some of the other functions I wanted the archive drop downs to do.

But yes! It seemed really easy to use and like it would be a good alternative solution.

Thanks,
Amanda

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
11
May 17, 2014 - 4:38 am
sp_Permalink sp_Print

Actually the widgets reloaded plugin works on very basic WordPress functions that haven't changed since 2.8.  The plugin should be compatible with WordPress without ever being updated foreseeable future.

Avatar
Ronen Laviv
Jedi
Members

Community Member
Forum Posts: 251
Member Since:
November 1, 2013
sp_UserOfflineSmall Offline
12
December 18, 2014 - 12:14 pm
sp_Permalink sp_Print

Kieth, thanks for the code. 1.5 years later... still works like a charm.

Avatar
Keith W Jones
Somerset, UK
Member
Members

Community Member
Forum Posts: 1441
Member Since:
June 22, 2013
sp_UserOfflineSmall Offline
13
December 18, 2014 - 3:53 pm
sp_Permalink sp_Print

smile

Keith W Jones
Make sure you backup before upgrading and making changes.
Best results when one question per thread, link to site, version of WP, Thesis and skin.
http://www.kwjassociates.co.uk - Wordpress 5.1.1 – Thesis 2.8.5 - Focus

 

*** Biggest cause of problems is now the cache, whether it is a plugin, the browser or your host's server. ***
*** Do not edit Skin and Editor CSS - make changes using Custom CSS. ***
*** Do not edit core files - make changes using custom.php or master.php. ***
Forum Timezone: America/Los_Angeles

Most Users Ever Online: 228

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Keith W Jones: 1441

Brian Tozer: 1004

Carolin: 984

Heidi Hafner: 509

John Cunningham: 423

Reece Morrel: 353

Newest Members:

soundpilot

digitalaerolus

emma62755

sharonmarks

emma80233

Tijs de Jong

Forum Stats:

Groups: 8

Forums: 46

Topics: 7003

Posts: 34845

 

Member Stats:

Guest Posters: 6

Members: 6763

Moderators: 2

Admins: 2

Administrators: Rick Anderson, Rick Anderson

Moderators: Pierre Cote, Laura Nugent