Activity Stream
48,167 MEMBERS
6772 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 4 of 4
  1.     
    #1
    Member
    Website's:
    goathiphop.com

    Default How can I only display the subcategory?

    I've spent the last couple of hours on google and found about 20 different ways of doing this but none seem to work.

    Each page has a different MP3. At the top of the page I have the Title, Artist, Album, Year, etc.
    Artist displays the Category (the alphabet letter related to the Name) and Sub-category (name of the Artist)

    Below I have an example:



    I would like to display only the Name (sub-category) and leave out the main category.

    This is the original code that displays both Cat + Sub:
    PHP Code: 
    <tr>
                            <td width="20%"> 
                                <strong><?php _e('Artist','mp3_det'); ?></strong>
                            </td>
                            <td>
                                  <?php the_category(', '); ?>

                            </td>
                            
                        </tr>
    these are some examples of I found BUT they don't work for me:
    PHP Code: 
    <?php
    if($post->post_parent)
    $children wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    if (
    $children) { ?>
    <ul>
    <?php echo $children?>
    </ul>
    <?php ?>
    PHP Code: 
    <?php
            
    if (is_category()) {
            
    $this_category get_category($cat);
            }
            
    ?>
            <?php
            
    if($this_category->category_parent)
            
    $this_category wp_list_categories('orderby=id&show_count=0
            &title_li=&use_desc_for_title=1&child_of='
    .$this_category->category_parent.
            
    "&echo=0"); else
            
    $this_category wp_list_categories('orderby=id&depth=1&show_count=0
            &title_li=&use_desc_for_title=1&child_of='
    .$this_category->cat_ID.
            
    "&echo=0");
            if (
    $this_category) { ?>
         
        <ul>
        <?php echo $this_category?>
         
        </ul>
         
        <?php ?>
    PHP Code: 
    $echo '<ul>' "\n";$childcats get_categories('child_of=' $cat '&hide_empty=1');foreach ($childcats as $childcat) {    if (== $childcat->category_parent) {        $echo .= "\t" '<li><a href="' get_category_link($childcat->cat_ID).'" title="' $childcat->category_description '">';        $echo .= $childcat->cat_name '</a>';        $echo .= '</li>' "\n";    }}$echo .= '</ul>' "\n";echo $echo
    I have a lot more but there is no point adding them here.

    Does anyone know what I can do to make this work?
    Thanks
    f4n3 Reviewed by f4n3 on . How can I only display the subcategory? I've spent the last couple of hours on google and found about 20 different ways of doing this but none seem to work. Each page has a different MP3. At the top of the page I have the Title, Artist, Album, Year, etc. Artist displays the Category (the alphabet letter related to the Name) and Sub-category (name of the Artist) Below I have an example: http://i1208.photobucket.com/albums/cc364/f4n3/nicki.png I would like to display only the Name (sub-category) and leave out the main Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Hi buddy,

    Try this:

    Code: 
    <?php
           foreach((get_the_category()) as $childcat) {
                  if (cat_is_ancestor_of($categoryid, $childcat)) {
                         echo '<a href="'.get_category_link($childcat->cat_ID).'" title="See more in '.$childcat->cat_name.'">';
                          echo $childcat->cat_name . '</a></li> ';
                  }}
    ?>
    Hope it helps!

  4.     
    #3
    Member
    Website's:
    goathiphop.com
    its working thanks bjskid !

  5.     
    #4
    Member
    Quote Originally Posted by f4n3 View Post
    its working thanks bjskid !
    No problems mate! You're welcome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Thread Display Help
    By tractor3231 in forum vBulletin
    Replies: 1
    Last Post: 13th Sep 2011, 12:08 PM
  2. Help To display Offers
    By San143 in forum Web Development Area
    Replies: 2
    Last Post: 15th Aug 2011, 07:11 AM
  3. Display your work
    By Cooper in forum Graphics Area
    Replies: 0
    Last Post: 10th Apr 2011, 07:37 PM
  4. Display problem
    By Th3Kill33r in forum Technical Help Desk Support
    Replies: 0
    Last Post: 13th Nov 2010, 12:02 AM
  5. How Big Is Your Primary Display?
    By Daniel in forum Polling Plaza
    Replies: 49
    Last Post: 3rd Aug 2010, 03:33 PM

Tags for this Thread

BE SOCIAL