Monday, November 30, 2020
Home Blogging How to Display Category Descriptions in WordPress

How to Display Category Descriptions in WordPress

Do you wish to show category descriptions in your WordPress web site? Classes will let you simply type content material in your web site. In addition they assist customers simply discover content material and are good for search engine marketing. On this article, we’ll present you methods to simply show category descriptions in WordPress.

Including Category Descriptions in WordPress

WordPress comes with two built-in taxonomies known as classes and tags. These taxonomies will let you simply type your content material into completely different matters.

When used appropriately, classes and tags can be very useful in enhancing your WordPress search engine marketing.

WordPress permits you to add descriptions to your classes. Nonetheless, many customers don’t discover it as a result of they create classes when writing a publish which doesn’t allow them to add description.

Right here is methods to simply add description to your classes.

Head over to Posts » Classes web page. In case you are creating a brand new class, then you may merely enter class title and outline right here after which click on on ‘Add new class’ button.

If you wish to add description to an current class, then you’ll want to click on on the ‘Edit’ hyperlink under that class.

This may take you to class edit display screen the place you may add description to your class.

Don’t neglect to click on on the ‘Replace’ button to save lots of your modifications.

Repeat the method so as to add descriptions to all of your classes. You should utilize the identical technique so as to add descriptions for tags as effectively.

Show Category Description on Class Archive Web page

Most WordPress themes will routinely show the category description on the class archive pages.

Nonetheless in case your theme doesn’t show category description on archive pages, then you’ll need to edit your theme information.

Connect with your WordPress web site utilizing an FTP shopper after which go to /wp-content/themes/your-current-theme/ folder.

Now you’ll need to find and edit class.php file. In case your theme doesn’t have class.php file, then you’ll need to edit archive.php file.

Copy and paste this code the place you desire to the category description to be displayed.

1
2
3
<?php
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>

Now you can save your modifications and add the file again to your web site.

After that, you may go to the class archive web page in your web site to see the outline in motion.

Show Category Description in WordPress Theme

If you wish to show the category description in different elements of your web site, then you can too use the category_description template tag:

1
<?php echo category_description(3); ?>

Don’t neglect to exchange Three with your personal class ID.

If you wish to show category description inside a single publish, then you should use this code.

1
2
$catID = get_the_category();
echo category_description( $catID[0] );

This code merely will get all classes for the present publish after which outputs the category description of the primary class.

If you want to checklist all of your WordPress classes with an outline in checklist format, then you may add this code in your theme’s features.php file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function wpb_catlist_desc() {
$string = '<ul>';
$catlist = get_terms( 'category' );
if ( ! empty( $catlist ) ) {
  foreach ( $catlist as $key => $item ) {
    $string .= '<li>'. $item->name . '<br />';
    $string .= '<em>'. $item->description . '</em> </li>';
  }
}
$string .= '</ul>';
return $string;
}
add_shortcode('wpb_categories', 'wpb_catlist_desc');

This code creates a shortcode which shows all of your classes and their descriptions in a plain checklist.

Now you can use [wpb_categories] in your posts and pages. To make use of this shortcode inside a textual content widget, you’ll need to allow shortcodes for widgets.

You May Also Like : 32 Extremely Useful Tricks for the WordPress Functions File

We hope this text helped you learn to add and show category descriptions in WordPress. You might also wish to see our checklist of most wished class hacks and plugins for WordPress.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

How to Signup for Godaddy Affiliate Program & Start Making Money

GoDaddy is likely one of the well-liked model names out there of area and web-hosting. They are well-liked for a numerous cause, and so they...

How To Start Selling Website on Flippa: A Beginner’s Guide To Success

If you may have been working on-line for lengthy and into Website flipping, Flippa is one identify that you need to have heard of. Flippa is a...

How to Fix Your Connection is Not Private Error (Site Owners Guide)

Are you seeing ‘Your connection is not private’ error in your WordPress web site? This is the error message you’ll see on Google Chrome. The...

How to Fix the WordPress White Page of Death (Step by Step)

The WordPress white page of dying is one of the most widespread WordPress errors. It can also be one of the most irritating ones as...

Recent Comments