Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-17-2010, 09:13 PM   #1
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
:stop Wordpress, php, and css question (help me please)

Hello. Im trying to style the wp_list_categories tag (<?php

wp_list_categories('arg'); ?>). i know that i can style it using an unordered list and css. Something like this:

<ul class="cat_list"><?php

wp_list_categories('show_count=1&hide_empty=1&titl e_li=<h2>Categories</

h2>'); ?></ul>

That will print a list of categories, hide categories with zero post, and show title called "categories". What i would like to do though is make the parent category links look different from the child category links (have a different font size or use <h3> tag for parent category), so i how would i do that? Like i said I know how to style whole list but how can I make this customization happen? Or is it not possible? Thanks for any help.
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

Last edited by tonyparra; 06-17-2010 at 09:15 PM..
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-17-2010, 09:44 PM   #2
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
bumperoo
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-17-2010, 09:56 PM   #3
mattz
Confirmed User
 
Industry Role:
Join Date: Dec 2001
Location: AZ
Posts: 7,697
bump for ya
mattz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-17-2010, 10:08 PM   #4
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
well, I don't have an example with categories and subcategories at hand (oh my, why in hell every single person asking for help NEVER includes the example so they can actually be helped?) but if you constructed it using defaults you should have something like

Code:
<ul>
<li>Cat 1</li>
<li>Cat2
     <ul>
          <li> Cat 2 Children category </li>
     </ul>
</li>
</ul>
where
Code:
<li> Cat 2 Children category </li>
will have a class named .children or .child or something like that (don't remember right now, and since nobody post examples.... ). Just style that class and you'll be done
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 07:05 AM   #5
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
Quote:
Originally Posted by harvey View Post
well, I don't have an example with categories and subcategories at hand (oh my, why in hell every single person asking for help NEVER includes the example so they can actually be helped?) but if you constructed it using defaults you should have something like

Code:
<ul>
<li>Cat 1</li>
<li>Cat2
     <ul>
          <li> Cat 2 Children category </li>
     </ul>
</li>
</ul>
where
Code:
<li> Cat 2 Children category </li>
will have a class named .children or .child or something like that (don't remember right now, and since nobody post examples.... ). Just style that class and you'll be done

sorry i was tired when i made thread...the wp_list_categories prints your category list heres a snippet of code from the default wordpress theme sidebar:
Code:
<?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
that will print a list in alphabetical order with child categories, and post count. An example of what i currently have can be found in the default wp theme, an example of what i would like my list to look like can be found here:
http://www.hotmovies.com/categories.php
The parent cats are bold and using the <h3> tag, therefore helping to show the difference between parent and child cats. Is that possible in wordpress?
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 07:36 AM   #6
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
bump for me
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 07:52 AM   #7
cyber
Confirmed User
 
cyber's Avatar
 
Industry Role:
Join Date: Jan 2004
Posts: 182
Code:
$sql = "SELECT name,slug,$wpdb->terms.term_id as ID,parent FROM $wpdb->terms ".
       "LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) ".
       "WHERE parent=5 AND taxonomy='category' ORDER BY name ASC";
$categoryList = $wpdb->get_results($sql);

echo categoryPrint($categoryList);



function categoryPrint($results, $multiple = "", $subcat_level = 0){
  global $wpdb;
  if(!$results){return;}
  foreach($results as $a_cat){
    if($multiple){
      categoryPrintSelectItem($a_cat, $subcat_level);
    }
    else{
      categoryPrintItem($a_cat, $subcat_level);
    }
    $sql = "SELECT name,slug,$wpdb->terms.term_id as ID,parent FROM $wpdb->terms ".
           "LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) ".
           "WHERE parent=$a_cat->ID AND taxonomy='category' ORDER BY name ASC";
    $sub_cats = $wpdb->get_results($sql); 
    categoryPrint($sub_cats, $multiple, $subcat_level + 1);
  }
}
function categoryPrintSelectItem($a_cat, $subcat_level){
  for($i = 0; $i < $subcat_level; $i++){
    echo "…";
  }
  echo $a_cat->name."</option>\n";
}
function categoryPrintItem($a_cat, $subcat_level){
  for($i = 0; $i < $subcat_level; $i++){
    echo "{$a_cat->name}<br>";
  }
  if($subcat_level < 1){
    echo "<b><h3>{$a_cat->name}</h3></b><br>";
  }
}
Change this:

Code:
WHERE parent=5
To the category's ID.
cyber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 08:24 AM   #8
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,372
Quote:
Originally Posted by cyber View Post
Code:
$sql = "SELECT name,slug,$wpdb->terms.term_id as ID,parent FROM $wpdb->terms ".
       "LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) ".
       "WHERE parent=5 AND taxonomy='category' ORDER BY name ASC";
$categoryList = $wpdb->get_results($sql);

echo categoryPrint($categoryList);



function categoryPrint($results, $multiple = "", $subcat_level = 0){
  global $wpdb;
  if(!$results){return;}
  foreach($results as $a_cat){
    if($multiple){
      categoryPrintSelectItem($a_cat, $subcat_level);
    }
    else{
      categoryPrintItem($a_cat, $subcat_level);
    }
    $sql = "SELECT name,slug,$wpdb->terms.term_id as ID,parent FROM $wpdb->terms ".
           "LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) ".
           "WHERE parent=$a_cat->ID AND taxonomy='category' ORDER BY name ASC";
    $sub_cats = $wpdb->get_results($sql); 
    categoryPrint($sub_cats, $multiple, $subcat_level + 1);
  }
}
function categoryPrintSelectItem($a_cat, $subcat_level){
  for($i = 0; $i < $subcat_level; $i++){
    echo "?";
  }
  echo $a_cat->name."</option>\n";
}
function categoryPrintItem($a_cat, $subcat_level){
  for($i = 0; $i < $subcat_level; $i++){
    echo "{$a_cat->name}<br>";
  }
  if($subcat_level < 1){
    echo "<b><h3>{$a_cat->name}</h3></b><br>";
  }
}
Change this:

Code:
WHERE parent=5
To the category's ID.
thats a sure messy way to do it, when you can do it with css.

have a look at the default wordpress css styling, theirs one for child cats.

http://digwp.com/2010/05/default-wor...-styles-hooks/
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 08:36 AM   #9
cyber
Confirmed User
 
cyber's Avatar
 
Industry Role:
Join Date: Jan 2004
Posts: 182
Quote:
Originally Posted by fris View Post
thats a sure messy way to do it, when you can do it with css.

have a look at the default wordpress css styling, theirs one for child cats.

http://digwp.com/2010/05/default-wor...-styles-hooks/
I repurposed to code from a page of mine that prints out the categories in form select fields for something totally different.

Figured this would get the job done without telling him what CSS styles he needed to change ;)
cyber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 10:32 AM   #10
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
Quote:
Originally Posted by fris View Post
thats a sure messy way to do it, when you can do it with css.

have a look at the default wordpress css styling, theirs one for child cats.

http://digwp.com/2010/05/default-wor...-styles-hooks/
hmm so are you saying style the child cats maybe i can bold the parents im having a hard time putting that together though can you help me out?
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 12:00 PM   #11
tonyparra
Confirmed User
 
tonyparra's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: In your back seat with duck tape
Posts: 4,568
this may require custom solution it seems...
__________________

High Performance Vps $10 Linode
Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
tonyparra is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 02:07 PM   #12
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
Quote:
Originally Posted by tonyparra View Post
sorry i was tired when i made thread...the wp_list_categories prints your category list heres a snippet of code from the default wordpress theme sidebar:
Code:
<?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
that will print a list in alphabetical order with child categories, and post count. An example of what i currently have can be found in the default wp theme, an example of what i would like my list to look like can be found here:
http://www.hotmovies.com/categories.php
The parent cats are bold and using the <h3> tag, therefore helping to show the difference between parent and child cats. Is that possible in wordpress?
yes, I know you used that hook, I just shown you the output. So here you have since your code is outputting something different to what it should be (not your fault, probably a change in WP, you're using the correct function as documented):

Code:
<?php $sub_cat =  wp_list_categories('echo=0&amp;orderby=name&amp;title_li=&amp;hierarchical=0&amp;child_of='.$category->cat_ID); ?>
	<ul class="subcat"><?php echo $sub_categories; ?></ul>
<?php } ?>
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 06:06 PM   #13
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,372
hit me up on icq 704-299 ill see if i can sort you out
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-18-2010, 06:15 PM   #14
Deej
I make pixels work
 
Deej's Avatar
 
Industry Role:
Join Date: Jun 2005
Location: I live here...
Posts: 24,386
Watch out... I ICQ'd Fris once and all the sudden my dog died.

ICQ at your own risk...
__________________

Deej's Designs n' What Not
Hit me up for Design, CSS & Photo Retouching


Icq#30096880
Deej is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.