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 = "All Categories";
 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 = "All Categories";
That’s it! Isn’t it easy?!?! If you have questions or clarifications, please don’t hesitate to leave a comment below.
Do you love this article and you want to receive more interesting posts from Bryan Veloso? Why not subscribe to this blog via e-mail? It's easy! Just enter your e-mail address below and confirm your subscription by clicking the activation link that will be sent to your e-mail! Get your free subscription now!