: category description display : cspub October 17, 2015, 12:18:07 PM I wanted to display the category description on the category pages. In wordpress forum I see that you are to add this code to the category.php page
<?php echo category_description( $category_id ); ?> but I've tried placing it in several pages then my site is broken and I have to remove it. Can you tell me where to put it so that my site isn't broken? : Re: category description display : Tristan Rineer October 19, 2015, 08:12:07 AM That code would need to go in the content.php file, but the actual location would be based on where you want it to display. You may also need to remove the open & close PHP tags around that code if where you want to place it is inside already existing PHP.
: Re: category description display : cspub October 19, 2015, 10:22:57 AM That code would need to go in the content.php file, but the actual location would be based on where you want it to display. You may also need to remove the open & close PHP tags around that code if where you want to place it is inside already existing PHP. thanks for the reply. i'm wanting the description for category to show at top of the category page, before the actual post. so do i put it inside other php or list as is? if i put inside code, where or what code do i put in, and what are the actual open/close php tags? thanks : Re: category description display : Tristan Rineer October 20, 2015, 09:04:59 AM The PHP tags are:
: <?php and ?> If you want to have the category description show above the posts, you will most likely want to put it on a new line immediately above : while ( have_posts() ) : the_post(); That is within existing PHP, so you'll want to remove the PHP tags around the new code. : Re: category description display : cspub October 20, 2015, 11:10:57 AM That works, but I might have misstated what I was wanting.
I wanted the description to only show on the category page, not each individual article in that category. Placing on the content page made it come up on each article. I was just trying to have the main category page show the description. That is why I thought it went on the category page. : Re: category description display : Tristan Rineer October 20, 2015, 01:38:27 PM Try using this code instead:
: if(!is_singular()){ echo category_description( $category_id );} If that doesn't work, then I'm going to have to suggest that you try posting to the Hire-a-Coder (http://www.shape5.com/hire_a_coder/) area, as what you are trying to do is custom coding, and is not covered by support. |