Elegant Themes ePanel: Add All Categories in Featured Category Options


If you’re an Elegant Themes user and you’re a complete PHP noob and you want to add “All Categories” as an additional option in your featured category inside your ePanel, because by default, there are no “All Categories” option in the featured category options of Elegant Themes’ ePanel, then your search is over.

All you need to do is add one line of PHP code inside your options PHP file. The file name is not exactly options.php, it depends on what kind of Elegant Theme you’re using. Let’s take ET’s Pure Type theme for example. You need to open the options_puretype.php inside your theme folder. Then look for the line site_cats = array. All you need to do is add a single line of PHP code somewhere in line 13. You can put it anywhere you want anyway if you want to. But if you want to follow my instructions because you don’t have a single idea what to do, then refer to the code below:

 
$cats_array = get_categories('hide_empty=0');
$pages_array = get_pages('hide_empty=0');
$site_pages = array();
$site_cats = array();
$pages_ids = array();
$cats_ids = array();

As you can see above, the last line is the array of category IDs. Just add one line of code after cats_ids = array. Add the code below:

 
$site_cats[0] = "All Categories";

[0] means it will show the all the options and the option text will be “All Categories”. After adding that single line of code, it should look like this:

 
$cats_array = get_categories('hide_empty=0');
$pages_array = get_pages('hide_empty=0');
$site_pages = array();
$site_cats = array();
$pages_ids = array();
$cats_ids = array();
$site_cats[0] = "All Categories";

That’s it! Isn’t it easy?!?! If you have questions or clarifications, please don’t hesitate to leave a comment below.


Comments

One response to “Elegant Themes ePanel: Add All Categories in Featured Category Options”

  1. This was very useful to me, thank you very very much!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.