Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 02-08-2010, 07:22 PM   #1
HyperActive Warrior
 
moodykitty's Avatar
 
Join Date: Feb 2005
Location: Bay Area, USA.
Posts: 445
Thanks: 25
Thanked 20 Times in 15 Posts
Default Wordpress Coding Question

Hi all,

Hope someone can help. I'm trying to add some code to the category.php file so that when you click on a category you get a list of the child categories, grandchild categories and posts.

I found this code somewhere but it only lists the child categories:

PHP Code:
<?php // list child categories
$cat_id get_query_var('cat');

$catlist wp_list_categories('echo=0&orderby=id&title_li=&child_of=' $cat_id);

if (
$catlist) {
echo 
$catlist;
} else {
echo 
"Please don't print No categories";
?>
plus when you click on a child category it says No Categories.

Can someone help?

let me know! thanks

C

I would rather believe in God and die finding out there isn't a God then not believe in God and die finding out THERE IS A GOD.
-------------------
Animal School

moodykitty is offline   Reply With Quote
Old 02-08-2010, 08:11 PM   #2
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: Wordpress Coding Question

Are you returning a value for the $cat_id variable? You could replace the "Please don't print No categories" with the variable just to make sure. Otherwise I don't see any obvious errors.

I'm sure you've already seen this:

Template Tags/wp list categories WordPress Codex


Bill
mywebwork is offline   Reply With Quote
Old 02-08-2010, 10:06 PM   #3
HyperActive Warrior
 
moodykitty's Avatar
 
Join Date: Feb 2005
Location: Bay Area, USA.
Posts: 445
Thanks: 25
Thanked 20 Times in 15 Posts
Default Re: Wordpress Coding Question

Thanks for answering Bill. It's not my code (got it here: WordPress › Support Display List of Current Category's Children OR Posts ) and I don't write code so I really don't know the answer to your question.
Could you tell me what I need to replace "Please don't print No categories" with?

Thanks again

ps. I could pay you a small fee for your help... pm me to let me know what you would charge.

I would rather believe in God and die finding out there isn't a God then not believe in God and die finding out THERE IS A GOD.
-------------------
Animal School

moodykitty is offline   Reply With Quote
Old 02-08-2010, 10:28 PM   #4
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: Wordpress Coding Question

Hi moodykitty - this is what I meant.

Rewrite the section of code that says this:

echo "Please don't print No categories";

To look like this:

echo "Category ID is " . $cat_id;

Run it and look at your error message, if it just says "Category ID is " and is not followed by a number then your problem is that no value is defined by the 'cat' variable.

And yes, I'd be happy to assist you if you're still stumped - I will send you a PM.



Bill
mywebwork is offline   Reply With Quote
Old 02-09-2010, 11:22 AM   #5
HyperActive Warrior
 
moodykitty's Avatar
 
Join Date: Feb 2005
Location: Bay Area, USA.
Posts: 445
Thanks: 25
Thanked 20 Times in 15 Posts
Default Re: Wordpress Coding Question

Bill,

Thanks, it still shows No Categories.

I'll pm you later....

thanks for you help

I would rather believe in God and die finding out there isn't a God then not believe in God and die finding out THERE IS A GOD.
-------------------
Animal School

moodykitty is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
coding, question, wordpress

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 10:26 PM.