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

Reply
 
LinkBack Thread Tools
Old 10-04-2009, 12:43 PM   #1
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Need help getting category menu to format

I have a theme which lists my pages in a horizontal menu, with drop down sub-menu items for the sub-pages. I wanted to add a menu item for categories, so I added the following code to my menu.php script ...

Code:
<?php 
wp_list_categories('sort_column=name&sort_order=asc&include=22,24,25&style=list&children=true&hierarchical=true&title_li=' . __('Memberships') . ' ''); 
?>
But, when the page was rendered, there was no margin between the menu item separator and the menu text, so I added spaces into the title so that the ('Memberships') part of the code became (' Memberships ')...

Code:
<?php 
wp_list_categories('sort_column=name&sort_order=asc&include=22,24,25&style=list&children=true&hierarchical=true&title_li=' . __(' Memberships ') . ' ''); 
?>
There was no change, as it appeared Wordpress had stripped the spaces out. So I did a little research, and added a div with float and margins ...

Code:
<div class="kwadded" style="float:left; margin-left: 10px; margin-right: 10px;">
<?php 
wp_list_categories('sort_column=name&sort_order=asc&include=22,24,25&style=list&children=true&hierarchical=true&title_li=' . __('Memberships') . ' ''); 
?>
</div>
I got the left margin spaced, but the right margin was again stripped out. So I played with it and found that by adding a space and a character to the ('Memberships') part of the code, making it ('Memberships |'), I could simulate a right margin. (I used the pipe symbol trying to be unobtrusive.) The code is ...

Code:
<div class="kwadded" style="float:left; margin-left: 10px;">
<?php 
wp_list_categories('sort_column=name&sort_order=asc&include=22,24,25&style=list&children=true&hierarchical=true&title_li=' . __('Memberships  |') . ' ''); 
?>
</div>
You can see the results at Consultant Supply Room (Note that the categories aren't listed unless you are logged in. This question is only about getting a margin to appear in this added menu item.)

Can someone advise me of a way to get the menu item to include the right margin? Or, how to find out what is causing the problem? I don't know if it is being stripped out by the theme or Wordpress.

Thanks in advance,
Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-04-2009, 10:39 PM   #2
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Hi Kirk, these types of problems always grab my attention.

Can you tell me what theme this is based upon?
That would help me try it out and have a fiddle with it.
Which is another way of saying, I need to see more of what the menu.php file looks like.

Or someone's going to come along and have an "Ah Ha" moment for you but I'm happy to help out if that doesn't happen.

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-04-2009, 10:46 PM   #3
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Hi Tim,

I am using the iNews theme from iThemes (http://ithemes.com)

I have a redistribution license to the theme if you want to take a look.

And the aha's just aren't coming. I've piddled all evening.

Thanks,
Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-05-2009, 12:09 AM   #4
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Hey Kirk - what time is it over there?

Well whatever you are happy to do, I'm ok with.
You've probably become a bit weary eyed staring at this...

Just PM me the details - I'm around for a wee bit and I'd love to be able to have you go....WoooHooooo!

If you are into that kind of thing and then Get Some Sleep!

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-05-2009, 12:48 AM   #5
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Thanks for the offer Tim, I just sent you a PM, and a copy of the theme through another channel. I am getting bleary eyed as you probably guessed. It am 1:40 in the AM here. I'm off to nighty night.

Cheers, and all that sort of stuff.

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-05-2009, 02:02 AM   #6
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Ok Kirk,

I tried that snippet of code they gave you on the Forum with the UL's etc.. and it works.

So to get you going - use that instead of what you were trying.

It's manual but if it works - use it.

Code:
<li class="page_item"><a href="http://consultantsupplyroom.com/membership/">Membership</a>
<ul>
<li><a href=http://"http://consultantsupplyroom....ership-login/">Please Log In</a></li>
</ul>
</li>
Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-05-2009, 02:34 AM   #7
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Give me a nudge - yeah I'm awake!

Umm yes, as you stated in your email , you got that bit working.

To get the categories showing in the menu is going to take a little effort.

I'm still looking.

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-05-2009, 09:44 AM   #8
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Kirk,
I've had a god bash at it. It's interesting.

The problem is the classes being generated.
Listing of categories is a little different to pages. Having said that I've been playing with a new function to list the categories and make them look like pages for the menu only.

But as I'm getting a bit blurry eyed I'll have to give it a rest for now but I'll be back on it.

I'm trying to learn the in's and outs of Wordpress to make the propeller on my cap spin faster ( reference to being a nurd ) so it's why I've jumped in to help out.
Nothing better than a real life problem to solve.

We'll get there. There are a few ways to go and I'm just trying to find the one of least resistance by just changing the themes functions.

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-05-2009, 03:38 PM   #9
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Thanks Tim,

If you are able to do that, it might be a popular plugin. I see a lot of folks asking similar questions every now and then.

Will be waiting with baited breath ...

Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-06-2009, 09:17 AM   #10
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Kirk,

Check your email mate.
It's got some "Stuff" in it that should do the trick for the time being.


Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-06-2009, 09:38 AM   #11
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Great Job Tim ...

It looks beautiful ...

Any way to control which categories can be listed there? Say only certain ones in the list?

I see the exclude=> action ... can the include => be used to limit the inclusions to the certain ones?

However, that is a "picky" thing. It looks good enough I can live with it the way it is.

Thanks 407 gazillion times over.

Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-06-2009, 03:58 PM   #12
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Hi Kirk,

I'm glad it's working.

I thought you might want to have the "Exclude" ability

I'll give it a go at putting that in. I was just making sure what I got working so far was what you were after.

Only a few more days at my Day JOB and then I'm a free agent. So I'll have a bit more time.

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-06-2009, 09:48 PM   #13
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Thanks again Tim,

It's all beautiful. 'Exclude =>' worked out just fine. Took a minute or five to get my head in the right place. Now trying to figure out how to get the "No Categories" (which was edited to read "Please Log In") message to appear when no categories are allowed to show because they are protected.

Will play and think.
Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Old 10-07-2009, 09:05 AM   #14
HyperActive Warrior
War Room Member
 
Tim Brownlaw's Avatar
 
Join Date: Oct 2009
Location: Berwick, Melbourne, Australia
Posts: 156
Thanks: 5
Thanked 48 Times in 29 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to Tim Brownlaw
Default Re: Need help getting category menu to format

Hi Kirk,

I've seen you've been having a good play with the "new" bit.

I'm learning up on making it a plug-in. Seems like fun...

One thing I have noticed though and that is - the words fall out of the menu when the category name get's too long.

A thought I had was to maybe use the category description field and have it display in the menu. That way you can keep your longer Categories showing up on the page and the abbreviated versions in the menu.

That was something I found in my digging around. Or the simpler way is to just have shorter category names.

I see now that's not an issue for you, but it's something to take into consideration.

It's all fun and thanks for letting me help you out. I appreciate it.

I've now started in on the Plugin writing side of things and this little exercise was just the ticket...

Cheers
Tim
Tim Brownlaw is offline   Reply With Quote
Old 10-07-2009, 09:13 AM   #15
Ungrateful S.O.B.
War Room Member
 
Kirk Ward's Avatar
 
Join Date: May 2006
Location: Ellijay, GA, USA. (Talk about being in the woods!)
Posts: 1,393
Thanks: 253
Thanked 57 Times in 45 Posts
Social Networking View Member's Twitter Profile 
Default Re: Need help getting category menu to format

Thanks Tim,

I had the problem with long category names before and now that this is working, I just went in and edited the names so that they would fit. It is not related to the function ... but maybe your idea of using the description field might provide a solution.

Thanks again, seventy or eighty times over.

Kirk

"We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
Kirk Ward is offline   Reply With Quote
Reply

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

Tags
category, format, menu

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 04:03 AM.