WordPress.org

Support

Support » Plugins and Hacks » [Resolved] how to display the catgory description

[Resolved] how to display the catgory description

  • kranthika
    Member

    @kranthika

    i have installed the plugin and able to add the html description

    but unable to display the description i have used this code <?php
    $args=array(
    ‘orderby’ => ‘name’,
    ‘order’ => ‘ASC’
    );
    $categories=get_categories($args);
    foreach($categories as $category) {
    echo ‘<p> Description:’. $category->description . ‘</p>’;
    }
    ?>

    but unable to display the description plz help me its urgent

    http://wordpress.org/extend/plugins/allow-html-in-category-descriptions/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Arno Esterhuizen
    Member

    @arnoesterhuizen

    Hi, Kranthika

    This isn’t directly related to the plugin, but I can try and help.

    According to the codex, that is the right code to use to access the category descriptions. Can you put a var_export($categories) after $categories=get_categories($args); and paste the results here?

    Thanks
    Arno

    mediabaron3000
    Member

    @mediabaron3000

    Hi Arno,

    Ive installed your plugin and got copy on the category page but it does not display…..is this the theme itself ?

    My categories.php files looks like this.

    <?php get_header(); ?>
    
    <div id="main">
    
    	<div id="post-area">
    
    		<div class="breadcrumb">
    
    			<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
    
    		</div>
    
    		<h1 class="page-header headline"><?php single_cat_title(); ?></h1>
    
    		<ul class="recent">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    			<li>
    
    			<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { /* if post has a thumbnail */ ?>
    
    			<div class="home-story-cat">
    
    				<div class="img-contain">
    
    					<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><?php the_post_thumbnail('small-thumb'); ?></a>
    
    				</div><!--img-contain-->
    
    				<div class="story-text">
    
    					<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    					<p><?php echo excerpt(32); ?></p>
    
    				</div><!--story-text-->
    
    			</div><!--home-story-cat-->
    
    			<?php } else { ?>
    
    			<div class="home-story-cat">
    
    				<div class="story-text-noimg">
    
    					<div class="cat-small"><?php the_category(); ?></div>
    
    					<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    					<p><?php echo excerpt(32); ?></p>
    
    				</div><!--story-text-->
    
    			</div>
    
    			<?php } ?>
    
    			</li>
    
    		<?php endwhile; endif; ?>
    
    		</ul>
    
    		<?php posts_nav_link(' — ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
    
    	</div><!--post-area-->
    
    </div><!--main -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Thanks heaps!

    Plugin Author Arno Esterhuizen
    Member

    @arno_esterhuizen

    Hi, mediabaron3000

    I don’t see your theme using the “category_description” function, which would display the category description.

    Try that and let me know, or create a new issue.

    Cheers
    Arno

    mediabaron3000
    Member

    @mediabaron3000

    Hi Arno,

    Thanks for the reply. Unfortunately I don’t know how to use this function. My coding is not great.

    Can I just paste `function sb_allow_category_desc_html() {
    foreach ( array( ‘pre_term_description’, ‘pre_link_description’, ‘pre_link_notes’, ‘pre_user_description’ ) as $filter ) {
    remove_filter( $filter, ‘wp_filter_kses’ );
    }
    foreach ( array( ‘term_description’, ‘link_description’, ‘link_notes’, ‘user_description’ ) as $filter ) {
    remove_filter( $filter, ‘wp_kses_data’ );
    }
    }
    add_action( ‘init’, ‘sb_allow_category_desc_html’ );`

    into my functions.php file. (copied from your review page).

    Failing that, is that something you could help me with ?

    Thanks very much Arno

    Plugin Author Arno Esterhuizen
    Member

    @arno_esterhuizen

    Hi, mediabaron3000

    Unfortunately adding that code wouldn’t help. Contact the theme creator and ask them to add the category descriptions to the theme.

    This plugin will then kick in and render the description in HTML.

    Cheers
    Arno

    mediabaron3000
    Member

    @mediabaron3000

    Thanks Arno,

    I already tried that but he said he was unable to help 🙁

    Sucks because its a really a great feature. Im happy to pay for sometimes time.

    Thanks anyway.

    Plugin Author Arno Esterhuizen
    Member

    @arno_esterhuizen

    Hi, mediabaron3000

    Can you email me a zipped copy of your theme to arno.esterhuizen+wordpress-plugins@gmail.com? I can then see what needs to be done and send you a quote.

    Cheers
    Arno

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] how to display the catgory description’ is closed to new replies.