GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Wordpress category description. Please, help. (https://gfy.com/showthread.php?t=747736)

everestcash 07-01-2007 10:23 PM

Wordpress category description. Please, help.
 
I wanna display descriptions next to each category name on index page, but I'm not familiar with PHP at all :(

I edited the code like this:

<?php wp_list_cats('sort_column=name'); ?> - <?php echo category_description($cat); ?>
but it doesn't work properly :(

Could you please advice? :helpme

p.s. I thought I need something like show_description parameter that exists for <?php get_links(); ?>
but seems like it doesn't exists for <?php wp_list_cats('); ?>

everestcash 07-01-2007 10:27 PM

or maybe you can just give me a link to any theme that uses category descriptions
so I could look for it in the code

everestcash 07-01-2007 11:48 PM

bump for me

peterp 07-02-2007 12:08 AM

please try it with these : <?php category_description(category); ?>

everestcash 07-02-2007 01:13 AM

thanks, but i've already tried that ((

Bods4Mods 07-02-2007 01:16 AM

bump for getting it solved

woman 07-02-2007 03:18 AM

Try this:
PHP Code:

<?php
$exclude 
'';

// $orderby - Category table column (record) to sort on; for column
// options see note #2 above.
$orderby 'cat_name';

// $order - The sort order method. Use 'ASC'ending or 'DESC'ending.
$order 'ASC';

/* << user-configurable variables << */

if($exclude) { // set up the category exclude list for the query
    
$and '';
    
$wherecat 'AND (';
    
$exclude_cat preg_split('/[\s,]+/'$exclude);
    foreach (
$exclude_cat as $xcat) {
        
$wherecat .= $and ' cat_ID <> ' $xcat ' ';
        
$and 'AND';
    }
    
$wherecat .= ')';
}

global 
$wpdb// making sure the WP database object is around
/* the next line assigns the query results to $categories */
$categories $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE category_count > 0 $wherecat ORDER BY $orderby $sort"); // $wp_object_cache->cache['category'];
?>
<?php 
/* >> category list loop >> the important part! */ ?>
<?php 
while(list(,$category) = each($categories)) : // start loop ?>
        <p>
        <h3 id="cat-<?php echo $category->cat_ID?>"><a href="<?php echo get_category_link($category->cat_ID); // returns category url ?>" title="<?php echo $category->cat_name?>"><?php echo $category->cat_name?></a></h3>
        <?php echo $category->category_description?> (<?php echo $category->category_count?> posts)
        </p>
<?php endwhile; // end loop ?>
<?php 
/* << category list loop << */ ?>

Greetings, woman

everestcash 07-02-2007 05:27 AM

Thanks A Lot!

woman 07-02-2007 05:47 AM

Always at your service! (For questions about wordpress :winkwink:)


All times are GMT -7. The time now is 07:34 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123