List of categories template
-
Hello,
I am wanting to style my list of categories as I am having them displayed in a HTML Select tag, with each of the categories being listed as Option tags with values (URLs). This way when the user selects one of the categories from the select options, my Javascripts uses the value of the Option tag to generate a URL.
Now the issue I’m having is making this list automatically update by WordPress with an up-to-date list of categories, rather than manually updating the PHP file.
Here is the code in the PHP:
<form class="categories"> <select onchange="navigateTo(this, 'window', false);"> <option selected="selected" selected disabled>Select category</option> <option value="/blog/company-news/">Company News</option> <option value="/blog/crowdfunding/">Crowdfunding</option> <option value="/blog/design/">Design</option> <option value="/blog/our-team/">Our Team</option> <option value="/blog/security/">Security</option> <option value="/blog/smart-home/">Smart Home</option> <option value="/blog/startups/">Startups</option> <option value="/blog/stuff/">Stuff</option> <option value="/blog/technical/">Technical</option> <option value="/blog/updates/">Updates</option> </select> </form>
I’d like to be using the WordPress PHP tag
<?php wp_list_categories(); ?>
used for listing the categories, but as it is above. I didn’t see much customisable in the list of arrays.Also I’d love to for the active category has a the ‘selected=”selected” selected’ option, instead of the top one.
Thanks in advance!
- The topic ‘List of categories template’ is closed to new replies.