go41

List subcategories in category bar of arthemia theme

von Joern am 13. Dez. 2008 | Keine Kommentare

In the WordPress theme Arthemia theme by Michael Jubel is a wide category bar displaying 5 categories and their description.

Users of this theme having sub-categories will normally not see them on this bar. I will show you how to get sub-categories displayed if there are in different styles.

Let’s talk about the free Arthemia Magazine Style WordPress Theme first:

The category bar is displayed by a call in index.php between the line 49:
div id=“cat-…
and the line 58:
/div
The line 56 (span class=“cat_title“) displays the main category title, we leave it untouched
In line 57 the category description is echoed: „echo category_description“

The code I give you now will check if the displayed category has children (subcategories) and if there are it will list all of them. If there are no sub-categories, it will display nothing.

The code to insert below or instead of the category description and before the following /div is here:

<?php $sub_categories = wp_list_categories("echo=0&show_count=1&title_li=&show_count=0&style=none&use_desc_for_title=0&child_of=$category"); if ($sub_categories != "No categories") { ?>
<?php wp_list_categories("show_count=1&title_li=&show_count=0&style=none&use_desc_for_title=0&child_of=$category"); ?>
<?php } ?>

This code will give you links to your subcategories for each category displayed in the category bar. There is a <br /> tag inserted between each link.

To get the subcategories inserted in a list style you could use this code instead, getting -ul-li-li-ul around links:

<?php $sub_categories = wp_list_categories("echo=0&show_count=1&title_li=&show_count=0&style=none&use_desc_for_title=0&child_of=$category"); if ($sub_categories != "No categories") { ?>
<ul class="subcats"><?php wp_list_categories("show_count=1&title_li=&show_count=0&use_desc_for_title=0&child_of=$category"); ?></ul>
<?php } ?>

Using the list-stylecode you can style the way how the ul class subcats get displayed.

You could add anywhere into your style.css the following:

ul.subcats {list-style: none;}

with this entry in style.css you get the list-bullets removed from the sub-category list.

Yes, there are also users having the Arthemia Premium theme, they have to look in header.php and use this code (Premium only!! in header.php below echo category_description($cp_pC) close to the end of that file)

<?php $sub_categories = wp_list_categories("echo=0&show_count=1&title_li=&show_count=0&style=none&use_desc_for_title=0&child_of=$cp_pC"); if ($sub_categories != "No categories") { ?>
<ul class="subcats"><?php wp_list_categories("show_count=1&title_li=&show_count=0&use_desc_for_title=0&child_of=$cp_pC"); ?></ul>
<?php } ?>

Style the ul class subcats to get the desired results…

sub categories in category WordPress The Administration Screen provides access to the control features of your WordPress installation. Each Administration Screen is presented in sections, the toolbar (and header), the main navigation, the work area, and the footer. Formerly known In AX2012, we can initiate the Purchases only if we have a procurement category hierarchy defined for the legal eny. So, let me just take you through “How a procurement category hierarchy should be created CSS.com. CSS has 2845 website templates coded usg HTML & CSS its . The HTML website templates that are showcased on CSS.com are the best that can be found Function Reference « WordPress Codex The files of defe many useful PHP functions. Some of the functions, known as Template Tags, are defed especially for use Themes. Tags: function, reference, wordpress, Great list.. The one I use is similar but I’ve been terested reducg the complexity of my list. I’m thkg of mergg several order to make my life easier, but I noticed

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.