Forum Support

Shape 5
March 28, 2024, 03:06:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Shape 5 Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: category description display  (Read 983 times)
cspub
Jr. Member
**
Offline Offline

Posts: 236



« on: 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?
Logged
Tristan Rineer
Global Moderator
*****
Offline Offline

Posts: 3858

Gravatar


« Reply #1 on: 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.
Logged

Tristan Rineer
------------
Shape 5 Team



- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
cspub
Jr. Member
**
Offline Offline

Posts: 236



« Reply #2 on: 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
Logged
Tristan Rineer
Global Moderator
*****
Offline Offline

Posts: 3858

Gravatar


« Reply #3 on: October 20, 2015, 09:04:59 AM »

The PHP tags are:
Code:
<?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
Code:
while ( have_posts() ) : the_post();

That is within existing PHP, so you'll want to remove the PHP tags around the new code.
Logged

Tristan Rineer
------------
Shape 5 Team



- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
cspub
Jr. Member
**
Offline Offline

Posts: 236



« Reply #4 on: 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.
Logged
Tristan Rineer
Global Moderator
*****
Offline Offline

Posts: 3858

Gravatar


« Reply #5 on: October 20, 2015, 01:38:27 PM »

Try using this code instead:
Code:
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 area, as what you are trying to do is custom coding, and is not covered by support.
Logged

Tristan Rineer
------------
Shape 5 Team



- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Looking for the largest variety in template designs? Look no more. Never buy 1 theme again. Signups start at just $89 for access to all of our themes.
Send Us An Email
Please send us your questions and we will email you back as soon as we can. Product support questions should be posted in our support forums under the Help menu. Our staff will assist you from there.