_
(@viniciusandre)
Not sure if I got the idea.
If I understood well, you can hack wp_list_categories to match only the children categories of the one you are.
So you’ll need to take the current category (see function reference) and put it in the middle of the query string of wp_list_categories.
Thank you, but I don’t really understand what that means yet.
Here is an example that I set up which shows what I am hoping to achieve. Though, I’m hoping it can be done in one template page and pull the category listing dynamically.
http://www.4shared.com/account/file/mj5eYsYO/categorie_portfolio_test.html
unfortunately, I believe this is way over my head at the moment.
_
(@viniciusandre)
You’ll need to study how these functions works, then. Most probably you can use wp_list_category [1] and get_the_category [2] to achieve this.
Something like:
$cat = get_the_category();
$cat = $cat[0]->cat_ID;
wp_list_categories('child_of='.$cat);
I you want to show (not list) the categories, use $cat value into wp_query or anything else that can show you the post.
I’m not sure if there’s a ‘codeless’ way of doing it, but if won’t, and also if you have no idea about what’s written up there, you’ll need to research a little bit through the docs and get more familiar with coding.
Hope it helps. Good luck.
[1] http://codex.wordpress.org/Template_Tags/wp_list_categories
[2] http://codex.wordpress.org/Function_Reference/get_the_category
Thanks for the info. I’ll keep looking into it.
Ok,
So, after some more digging, I came across a function that I think might work if someone could help me expand on it a little.
The function:
function portfolio(){
//
$args = array('orderby' => 'name','order' => 'ASC','exclude' => '1,5','hide_empty' => '0');
$categories = get_categories($args);
foreach($categories as $category) {
echo '<li><a href="' . get_category_link( $category->term_id ) . '" rel="' . strtolower(str_replace(' ', '-', $category->name)) . '" ' . '>' . $category->name.'</a></li>
';
}
}
which outputs:
<li><a href="http://localhost.localdomain/wp/category/portfolio/commissioned/" rel="commissioned" >commissioned</a></li>
<li><a href="http://localhost.localdomain/wp/category/portfolio/personal/" rel="personal" >personal</a></li>
and when one of those links are clicked, the result displays like this:
<p>gallerypost1</p>
<p>gallerypost2</p>
What I need to do is add some html elements to the last list providing links to single post pages rather than displaying the post content from a category in list form. So it would rather output to this:
<li><a href="http://localhost.localdomain/wp/category/portfolio/commissioned/gallerypost1" rel="gallerypost1" >gallerypost1</a></li>
<li><a href="http://localhost.localdomain/wp/category/portfolio/personal/gallerypost2" rel="gallerypost2" >gallerypost2</a></li>
Anyone understand how to set this up?
Thanks again for helping me get this far.
_
(@viniciusandre)
I’m not sure if I got it.. again.
Your function looks ok. Congratulations.
Perhaps you could use only wp_list_categories for the same effect. It’s up to you.
When you go to http://localhost.localdomain/wp/category/portfolio/commissioned/ we’re talking about your theme’s category.php file. There will be the way your posts are listed in a category browsing page.
Hope it helps. =D