php/ WP question

ugakebet

Premium Writing Solutions
Jul 15, 2009
219
2
0
El Nino
www.malpri.com
for 2 bloody days i have tried and i cant do this. *sob*sob*

basically i want to create the categories tag on separate li tags so that i can style them with jquery/html. but how do i do that???

this is my code (it displays all categories)
$counter++;wp_list_categories('hide_empty=0&title_li=')

now in order for each category to use a separate li, I assume that I need each category on a separate line and as such I cant use the above code (coz all categories are displayed together). So I used the “include” statement as such
wp_list_categories('include=3&hide_empty=0&title_li=');
I though this will display parent category 3 and its children automatically, but no, it only displays the stupid parent category ‘3’. But if I manually add the children, it works like so
wp_list_categories('include=3,10,11&hide_empty=0&title_li=');

in the above cat_id 10 and 11 are the children so everything is displayed correctly as
PARENT CATEGORY
>>CHILD 1
>>CHILD2

But I do not want to do anything manually, because what happens in the case that there are 100 children? I’m not gonna freakin manually add them all!!!
All I wanna achieve is this

2364573070105333494lhnNfc_fs.jpg



Oh yea, I have even tried this to no avail:
<?php


$criteria .= wp_list_categories('include=3’;
foreach ($sqls as $sql1){
$abc= $sql1->term_id;

$criteria .=.','. $abc;}

$criteria .='&hide_empty=0&hierarchical=1&title_li=');

echo $criteria?>
 


Hmmm, I'm not really sure what you are trying to do. Do you want unique CSS classes/IDs for your tags? wp_list_categories does a different list element per tag out of the box. I'm sure I can help, see A Better Tag Cloud, maybe you want to sponsor a feature. :-)
 
hey, i dont think i need a tag cloud, basically i wanna create the image above. and although i can manually do it by inserting <anchor text> </a> tags, i dont wanna do it coz then i have to link up each and every articel manually.
the wp_categories function of wp automatically creates links to the respective wp pages where the article will be located.
 
for 2 bloody days i have tried and i cant do this. *sob*sob*

basically i want to create the categories tag on separate li tags so that i can style them with jquery/html. but how do i do that???

this is my code (it displays all categories)
$counter++;wp_list_categories('hide_empty=0&title_li=')

now in order for each category to use a separate li, I assume that I need each category on a separate line and as such I cant use the above code (coz all categories are displayed together). So I used the “include” statement as such
wp_list_categories('include=3&hide_empty=0&title_li=');
I though this will display parent category 3 and its children automatically, but no, it only displays the stupid parent category ‘3’. But if I manually add the children, it works like so
wp_list_categories('include=3,10,11&hide_empty=0&title_li=');

in the above cat_id 10 and 11 are the children so everything is displayed correctly as
PARENT CATEGORY
>>CHILD 1
>>CHILD2

But I do not want to do anything manually, because what happens in the case that there are 100 children? I’m not gonna freakin manually add them all!!!
All I wanna achieve is this

2364573070105333494lhnNfc_fs.jpg



Oh yea, I have even tried this to no avail:
<?php


$criteria .= wp_list_categories('include=3’;
foreach ($sqls as $sql1){
$abc= $sql1->term_id;

$criteria .=.','. $abc;}

$criteria .='&hide_empty=0&hierarchical=1&title_li=');

echo $criteria?>

Your last try was close, but just build the string you need, then put it in wp_list_categories(), like:
Code:
$include_these= '';//whatever you do to get the ones you want

//put this inline with the html:
wp_list_categories('include='.$include_these.'&hide_empty=0&title_li=');