Salient Theme Display Category Description On Category Archives And Single Posts

The category description can be displayed under the category title on Salient Theme category archives and single posts.

See before and after…

Before:

After:

The following technique uses a WordPress child theme to show the category description on the category archive page and also on single post pages, for the Masonry Blog with Classic style and the Blog Header Type with Variable Height Minimal, however, you should be able to use the additional code to display the category description for other Blog Styles in the Salient theme.

I feel that child themes make it easier to manage theme updates, as the updates are only applied to the parent theme and leaving the child theme as is.

You can, however, use the additional code in the parent theme to display the category description and you will have to re-insert the code on theme updates.

First create a child theme directory on your local device, from the parent Salient theme. Click here to learn about child themes.

Displaying The Category Description On Category Archives

Create a functions.php text file in the root of the child theme, if you have not already started using a child theme functions.php file.

From the parent theme directory, open the functions.php file and find the block of code starting with the following if statement.

if ( !function_exists( 'nectar_page_header' ) ) {

Copy the whole if statement from the parent theme functions.php file, to the child theme functions.php. In version 7.0.8 of the Salient theme, this if statement is on 562 lines of code and looks like the code towards the bottom of this post.

Towards the end of if statement you will see a line of code as below that displays the post title in a h1 tag.

<h1><?php echo $heading; ?></h1>

Under the h1 tag enter the following code to display the category description under the category name on category archives.

<?php /*//BK*/ if ( category_description() ) { echo '<div>'.category_description().'</div>'; } ?>

This will display the category description for the Masonry Blog & Classic style.

If you search the if statement for other h1 tags that display the post title/heading then you should find places in the code for the other Blog styles where you can add the above code to display the category description.

The following CSS can be added to wp-admin > Salient > General Settings > CSS/Script Related to customise the display of category description text that appears under both the category name on category archives and also under the category name on single posts (see below for displaying the category description on single posts).

.row .col.section-title p {
font-family: "Domine";
font-size: 14px;
line-height: 20px;
padding-bottom: 0px;
padding-top: 5px;
}

The full if statement with the code to display the category description on category archives.

if ( !function_exists( 'nectar_page_header' ) ) {
function nectar_page_header($postid) {

global $options;
global $post;
global $nectar_theme_skin;

$bg = get_post_meta($postid, '_nectar_header_bg', true);
$bg_color = get_post_meta($postid, '_nectar_header_bg_color', true);
$font_color = get_post_meta($postid, '_nectar_header_font_color', true);
$parallax_bg = get_post_meta($postid, '_nectar_header_parallax', true);
$title = get_post_meta($postid, '_nectar_header_title', true);
$subtitle = get_post_meta($postid, '_nectar_header_subtitle', true);
$height = get_post_meta($postid, '_nectar_header_bg_height', true);
$page_template = get_post_meta($postid, '_wp_page_template', true);
$display_sortable = get_post_meta($postid, 'nectar-metabox-portfolio-display-sortable', true);
$inline_filters = (!empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1') ? '1' : '0';
$filters_id = (!empty($options['portfolio_inline_filters']) && $options['portfolio_inline_filters'] == '1') ? 'portfolio-filters-inline' : 'portfolio-filters';
$text_align = get_post_meta($postid, '_nectar_page_header_alignment', true);
$text_align_v = get_post_meta($postid, '_nectar_page_header_alignment_v', true);
$fullscreen_header = (!empty($options['blog_header_type']) && $options['blog_header_type'] == 'fullscreen' && is_singular('post')) ? true : false;
$post_header_style = (!empty($options['blog_header_type'])) ? $options['blog_header_type'] : 'default';
$bottom_shadow = get_post_meta($postid, '_nectar_header_bottom_shadow', true);
$bg_overlay = get_post_meta($postid, '_nectar_header_overlay', true);
$text_effect = get_post_meta($postid, '_nectar_page_header_text-effect', true);
$animate_in_effect = (!empty($options['header-animate-in-effect'])) ? $options['header-animate-in-effect'] : 'none';
(!empty($display_sortable) && $display_sortable == 'on') ? $display_sortable = '1' : $display_sortable = '0';

//incase no title is entered for portfolio, still show the filters
if( $page_template == 'template-portfolio.php' && empty($title)) $title = get_the_title($post->ID);

$bg_type = get_post_meta($postid, '_nectar_slider_bg_type', true);
if(empty($bg_type)) $bg_type = 'image_bg';

if( (!empty($bg) || !empty($bg_color) || $bg_type == 'video_bg' || $bg_type == 'particle_bg') && !is_post_type_archive( 'post' ) ) {

$social_img_src = (empty($bg)) ? 'none' : $bg;
$bg = (empty($bg)) ? 'none' : $bg;

if($bg_type == 'image_bg' || $bg_type == 'particle_bg') {
(empty($bg_color)) ? $bg_color = '#000' : $bg_color = $bg_color;
} else {
$bg = 'none'; //remove stnd bg image for video BG type
}
$bg_color_string = (!empty($bg_color)) ? 'background-color: '.$bg_color.'; ' : null;

if($bg_type == 'particle_bg') {
$rotate_timing = get_post_meta($postid, '_nectar_particle_rotation_timing', true);
$disable_explosion = get_post_meta($postid, '_nectar_particle_disable_explosion', true);
$shapes = get_post_meta($postid, '_nectar_canvas_shapes', true);
if(empty($shapes)) $bg_type = 'image_bg';
}
if($bg_type == 'video_bg') {
$video_webm = get_post_meta($postid, '_nectar_media_upload_webm', true);
$video_mp4 = get_post_meta($postid, '_nectar_media_upload_mp4', true);
$video_ogv = get_post_meta($postid, '_nectar_media_upload_ogv', true);
$video_image = get_post_meta($postid, '_nectar_slider_preview_image', true);
}
$box_roll = get_post_meta($postid, '_nectar_header_box_roll', true);
if(!empty($options['boxed_layout']) && $options['boxed_layout'] == '1') $box_roll = 'off';
$bg_position = get_post_meta($postid, '_nectar_page_header_bg_alignment', true);
if(empty($bg_position)) $bg_position = 'top';

if( $post_header_style == 'default_minimal' && ($post->post_type == 'post' && is_single())) {
$height = (!empty($height)) ? preg_replace('/\s+/', '', $height) : 550;
} else {
$height = (!empty($height)) ? preg_replace('/\s+/', '', $height) : 350;
}

$not_loaded_class = ($nectar_theme_skin != 'ascend') ? "not-loaded" : null;
$page_fullscreen_header = get_post_meta($postid, '_nectar_header_fullscreen', true);
$fullscreen_class = ($fullscreen_header == true || $page_fullscreen_header == 'on') ? "fullscreen-header" : null;
$bottom_shadow_class = ($bottom_shadow == 'on') ? " bottom-shadow": null;
$bg_overlay_class = ($bg_overlay == 'on') ? " bg-overlay": null;
$ajax_page_loading = (!empty($options['ajax-page-loading']) && $options['ajax-page-loading'] == '1') ? true : false;

if($animate_in_effect == 'slide-down') {
$wrapper_height_style = null;
} else {
$wrapper_height_style = 'style="height: '.$height.'px;"';
}
if($fullscreen_header == true && ($post->post_type == 'post' && is_single()) || $page_fullscreen_header == 'on') $wrapper_height_style = null; //diable slide down for fullscreen headers

$midnight_non_parallax = (!empty($parallax_bg) && $parallax_bg == 'on') ? null : 'data-midnight="light"';
if($box_roll != 'on') { echo '<div id="page-header-wrap" data-animate-in-effect="'. $animate_in_effect .'" data-midnight="light" class="'.$fullscreen_class.'" '.$wrapper_height_style.'>'; }
if(!empty($box_roll) && $box_roll == 'on') {
wp_enqueue_style('box-roll');
echo '<div class="nectar-box-roll">';
}
?>
<div class="<?php echo $not_loaded_class . ' ' . $fullscreen_class . $bottom_shadow_class . $bg_overlay_class; ?>" <?php if($post->post_type == 'post' && is_single()) echo 'data-post-hs="'.$post_header_style.'"'; ?> data-animate-in-effect="<?php echo $animate_in_effect; ?>" id="page-header-bg" <?php echo $midnight_non_parallax; ?> data-text-effect="<?php echo $text_effect; ?>" data-bg-pos="<?php echo $bg_position; ?>" data-alignment="<?php echo (!empty($text_align)) ? $text_align : 'left' ; ?>" data-alignment-v="<?php echo (!empty($text_align_v)) ? $text_align_v : 'middle' ; ?>" data-parallax="<?php echo (!empty($parallax_bg) && $parallax_bg == 'on') ? '1' : '0'; ?>" data-height="<?php echo (!empty($height)) ? $height : '350'; ?>" style="<?php echo $bg_color_string; ?> height: <?php echo (!empty($height)) ? $height : '350'; ?>px;">

<?php

if(!empty($bg) && $bg != 'none') { ?><div class="page-header-bg-image" style="background-image: url(<?php echo $bg; ?>);"></div> <?php } ?>

<?php if($bg_type != 'particle_bg') { echo '<div class="container">'; }


if($post->ID != 0 && $post->post_type && $post->post_type == 'portfolio') { ?>

<div class="row project-title">
<div class="container">
<div class="col span_6 section-title <?php if(empty($options['portfolio_social']) || $options['portfolio_social'] == 0 || empty($options['portfolio_date']) || $options['portfolio_date'] == 0 ) echo 'no-date'?>">

<h1><?php the_title(); ?></h1>
<?php if(!empty($subtitle)) { ?> <span class="subheader"><?php echo $subtitle; ?></span> <?php } ?>

<?php

global $options;
$single_nav_pos = (!empty($options['portfolio_single_nav'])) ? $options['portfolio_single_nav'] : 'in_header';

if($single_nav_pos == 'in_header') project_single_controls(); ?>

</div>
</div>

</div><!--/row-->







<?php } elseif($post->ID != 0 && $post->post_type == 'post' && is_single() ) {

// also set as an img for social sharing/
if($social_img_src != 'none') echo '<img class="hidden-social-img" src="'.$social_img_src.'" alt="'.get_the_title().'" />';

?>

<div class="row">

<div class="col span_6 section-title blog-title">
<div class="inner-wrap">

<?php if(($post->post_type == 'post' && is_single()) && $post_header_style == 'default_minimal') {

$categories = get_the_category();
if ( ! empty( $categories ) ) {
$output = null;
foreach( $categories as $category ) {
$output .= '<a class="'.$category->slug.'" href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', NECTAR_THEME_NAME), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>';
}
echo trim( $output);
}
} ?>

<h1 class="entry-title"><?php the_title(); ?></h1>

<?php if(($post->post_type == 'post' && is_single()) && $fullscreen_header == true ) { ?>
<div class="author-section">
<span class="meta-author vcard author">
<?php if (function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), 100 ); }?>
</span>
<div class="avatar-post-info">
<span class="fn"><?php the_author_posts_link(); ?></span>
<span class="meta-date date updated"><i><?php echo get_the_date(); ?></i></span>
</div>
</div>
<?php } ?>


<?php if($fullscreen_header != true) { ?>
<div id="single-below-header">
<span class="meta-author vcard author"><span class="fn"><?php echo __('By', NECTAR_THEME_NAME); ?> <?php the_author_posts_link(); ?></span></span><!--
--><span class="meta-date date updated"><?php echo get_the_date(); ?></span><!--
--><?php if($post_header_style != 'default_minimal') { ?> <span class="meta-category"><?php the_category(', '); ?></span> <?php } else { ?><!--
--><span class="meta-comment-count"><a href="<?php comments_link(); ?>"> <?php comments_number( __('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME) ); ?></a></span>
<?php } ?>
</div><!--/single-below-header-->
<?php } ?>

<?php if($fullscreen_header != true && $post_header_style != 'default_minimal') { ?>

<div id="single-meta" data-sharing="<?php echo ( !empty($options['blog_social']) && $options['blog_social'] == 1 ) ? '1' : '0'; ?>">
<ul>



<li class="meta-comment-count">
<a href="<?php comments_link(); ?>"><i class="icon-default-style steadysets-icon-chat"></i> <?php comments_number( __('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME) ); ?></a>
</li>
<li>
<?php echo '<span class="n-shortcode">'.nectar_love('return').'</span>'; ?>
</li>
<?php if( !empty($options['blog_social']) && $options['blog_social'] == 1 ) {

echo '<li class="meta-share-count"><a href="#"><i class="icon-default-style steadysets-icon-share"></i><span class="share-count-total">0</span></a> <div class="nectar-social">';


//facebook
if(!empty($options['blog-facebook-sharing']) && $options['blog-facebook-sharing'] == 1) {
echo "<a class='facebook-share nectar-sharing' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-facebook'></i> <span class='count'></span></a>";
}
//twitter
if(!empty($options['blog-twitter-sharing']) && $options['blog-twitter-sharing'] == 1) {
echo "<a class='twitter-share nectar-sharing' href='#' title='".__('Tweet this', NECTAR_THEME_NAME)."'> <i class='icon-twitter'></i> <span class='count'></span></a>";
}
//google plus
if(!empty($options['blog-google-plus-sharing']) && $options['blog-google-plus-sharing'] == 1) {
echo "<a class='google-plus-share nectar-sharing-alt' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-google-plus'></i> <span class='count'> ".GetGooglePlusShares(get_permalink($post->ID))." </span></a>";
}

//linkedIn
if(!empty($options['blog-linkedin-sharing']) && $options['blog-linkedin-sharing'] == 1) {
echo "<a class='linkedin-share nectar-sharing' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-linkedin'></i> <span class='count'> </span></a>";
}
//pinterest
if(!empty($options['blog-pinterest-sharing']) && $options['blog-pinterest-sharing'] == 1) {
echo "<a class='pinterest-share nectar-sharing' href='#' title='".__('Pin this', NECTAR_THEME_NAME)."'> <i class='icon-pinterest'></i> <span class='count'></span></a>";
}

echo '</div></li>';

}
?>



</ul>

</div><!--/single-meta-->

<?php } //end if theme skin default ?>
</div>
</div><!--/section-title-->
</div><!--/row-->





<?php //default
} else if($bg_type != 'particle_bg') {

if(!empty($box_roll) && $box_roll == 'on') {
$alignment = (!empty($text_align)) ? $text_align : 'left';
$v_alignment = (!empty($text_align_v)) ? $text_align_v : 'middle';
echo '<div class="overlaid-content" data-text-effect="'.$text_effect.'" data-alignment="'.$alignment.'" data-alignment-v="'.$v_alignment.'"><div class="container">';
} ?>

<div class="row">
<div class="col span_6">
<div class="inner-wrap">
<h1><?php echo $title; ?></h1>
<span class="subheader"><?php echo $subtitle; ?></span>
</div>

<?php // portfolio filters
if( $page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') { ?>
<div class="<?php echo $filters_id;?>" instance="0">
<a href="#" data-sortable-label="<?php echo (!empty($options['portfolio-sortable-text'])) ? $options['portfolio-sortable-text'] :'Sort Portfolio'; ?>" id="sort-portfolio"><span><?php echo (!empty($options['portfolio-sortable-text'])) ? $options['portfolio-sortable-text'] : __('Sort Portfolio',NECTAR_THEME_NAME); ?></span> <i class="icon-angle-down"></i></a>
<ul>
<li><a href="#" data-filter="*"><?php echo __('All', NECTAR_THEME_NAME); ?></a></li>
<?php wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter())); ?>
</ul>
</div>
<?php } ?>
</div>
</div>

<?php if(!empty($box_roll) && $box_roll == 'on') echo '</div></div><!--/overlaid-content-->';

} ?>



<?php if($bg_type != 'particle_bg') { echo '</div>'; } //closing container


if(($post->ID != 0 && $post->post_type == 'post' && is_single()) && $fullscreen_header == true || $page_fullscreen_header == 'on') {
$rotate_in_class = ( $text_effect == 'rotate_in') ? 'hidden' : null;
$button_styling = (!empty($options['button-styling'])) ? $options['button-styling'] : 'default';
if($button_styling == 'default'){
echo '<div class="scroll-down-wrap"><a href="#" class="section-down-arrow '.$rotate_in_class.'"><i class="icon-salient-down-arrow icon-default-style"> </i></a></div>';
} else {
echo '<div class="scroll-down-wrap '.$rotate_in_class.'"><a href="#" class="section-down-arrow"><i class="fa fa-angle-down top"></i><i class="fa fa-angle-down"></i></a></div>';
}

}


//video bg
if($bg_type == 'video_bg') {

if ( floatval(get_bloginfo('version')) >= "3.6" ) {
wp_enqueue_script('wp-mediaelement');
wp_enqueue_style('wp-mediaelement');
} else {
//register media element for WordPress 3.5
wp_register_script('wp-mediaelement', get_template_directory_uri() . '/js/mediaelement-and-player.min.js', array('jquery'), '1.0', TRUE);
wp_register_style('wp-mediaelement', get_template_directory_uri() . '/css/mediaelementplayer.min.css');

wp_enqueue_script('wp-mediaelement');
wp_enqueue_style('wp-mediaelement');
}

//parse video image
if(strpos($video_image, "http://") !== false || strpos($video_image, "https://") !== false){
$video_image_src = $video_image;
} else {
$video_image_src = wp_get_attachment_image_src($video_image, 'full');
$video_image_src = $video_image_src[0];
}

//$poster_markup = (!empty($video_image)) ? 'poster="'.$video_image_src.'"' : null ;
$poster_markup = null;
$video_markup = null;

$video_markup .= '<div class="video-color-overlay" data-color="'.$bg_color.'"></div>';


$video_markup .= '

<div class="mobile-video-image" style="background-image: url('.$video_image_src.')"></div>
<div class="nectar-video-wrap" data-bg-alignment="'.$bg_position.'">


<video class="nectar-video-bg" width="1800" height="700" '.$poster_markup.' preload="auto" loop autoplay>';
if(!empty($video_webm)) { $video_markup .= '<source type="video/webm" src="'.$video_webm.'">'; }
if(!empty($video_mp4)) { $video_markup .= '<source type="video/mp4" src="'.$video_mp4.'">'; }
if(!empty($video_ogv)) { $video_markup .= '<source type="video/ogg" src="'. $video_ogv.'">'; }

$video_markup .='</video>

</div>';

echo $video_markup;
}

//particle bg
if($bg_type == 'particle_bg') {

wp_enqueue_script('nectarParticles');

echo '<div class=" nectar-particles" data-disable-explosion="'.$disable_explosion.'" data-rotation-timing="'.$rotate_timing.'"><div class="canvas-bg"><canvas id="canvas" data-active-index="0"></canvas></div>';

$images = explode( ',', $shapes);
$i = 0;

if(!empty($shapes)) {

if(!empty($box_roll) && $box_roll == 'on') {
$alignment = (!empty($text_align)) ? $text_align : 'left';
$v_alignment = (!empty($text_align_v)) ? $text_align_v : 'middle';
echo '<div class="overlaid-content" data-text-effect="'.$text_effect.'" data-alignment="'.$alignment.'" data-alignment-v="'.$v_alignment.'">';
}

echo '<div class="container"><div class="row"><div class="col span_6" >';

foreach ( $images as $attach_id ) {
$i++;

$img = wp_get_attachment_image_src( $attach_id, 'full' );

$attachment = get_post( $attach_id );
$shape_meta = array(
'caption' => $attachment->post_excerpt,
'title' => $attachment->post_title,
'bg_color' => get_post_meta( $attachment->ID, 'nectar_particle_shape_bg_color', true ),
'color' => get_post_meta( $attachment->ID, 'nectar_particle_shape_color', true ),
'color_mapping' => get_post_meta( $attachment->ID, 'nectar_particle_shape_color_mapping', true ),
'alpha' => get_post_meta( $attachment->ID, 'nectar_particle_shape_color_alpha', true ),
'density' => get_post_meta( $attachment->ID, 'nectar_particle_shape_density', true ),
'max_particle_size' => get_post_meta( $attachment->ID, 'nectar_particle_max_particle_size', true )
);
if(!empty($shape_meta['density'])) {
switch($shape_meta['density']) {
case 'very_low':
$shape_meta['density'] = '19';
break;
case 'low':
$shape_meta['density'] = '16';
break;
case 'medium':
$shape_meta['density'] = '13';
break;
case 'high':
$shape_meta['density'] = '10';
break;
case 'very_high':
$shape_meta['density'] = '8';
break;
}
}

if(!empty($shape_meta['color']) && $shape_meta['color'] == '#fff' || !empty($shape_meta['color']) && $shape_meta['color'] == '#ffffff') $shape_meta['color'] = '#fefefe';

//data for particle shape
echo '<div class="shape" data-src="'.$img[0].'" data-max-size="'.$shape_meta['max_particle_size'].'" data-alpha="'.$shape_meta['alpha'].'" data-density="'.$shape_meta['density'].'" data-color-mapping="'.$shape_meta['color_mapping'].'" data-color="'.$shape_meta['color'].'" data-bg-color="'.$shape_meta['bg_color'].'"></div>';

//overlaid content
echo '<div class="inner-wrap shape-'.$i.'">';
echo '<h1>'.$shape_meta["title"].'</h1> <span class="subheader">'.$shape_meta["caption"].'</span>';
echo '</div>';

} ?>

</div></div></div>

<div class="pagination-navigation">
<div class="pagination-current"></div>
<div class="pagination-dots">
<?php foreach ( $images as $attach_id ) {
echo '<button class="pagination-dot"></button>';
} ?>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="690">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur"></feGaussianBlur>
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 69 -16" result="goo"></feColorMatrix>
<feComposite in="SourceGraphic" in2="goo" operator="atop"></feComposite>
</filter>
</defs>
</svg>

<?php if(!empty($box_roll) && $box_roll == 'on') echo '</div><!--/overlaid-content-->'; ?>

</div> <!--/nectar particles-->

<?php }
} //particle bg ?>

</div>

<?php

echo '</div>';

} else if( !empty($title) && !is_archive()) { ?>

<div class="row page-header-no-bg" data-alignment="<?php echo (!empty($text_align)) ? $text_align : 'left' ; ?>">
<div class="container">
<div class="col span_12 section-title">
<h1><?php echo $title; ?><?php if(!empty($subtitle)) echo '<span>' . $subtitle . '</span>'; ?></h1>

<?php // portfolio filters
if( $page_template == 'template-portfolio.php' && $display_sortable == '1' && $inline_filters == '0') { ?>
<div class="<?php echo $filters_id;?>" instance="0">

<a href="#" data-sortable-label="<?php echo (!empty($options['portfolio-sortable-text'])) ? $options['portfolio-sortable-text'] :'Sort Portfolio'; ?>" id="sort-portfolio"><span><?php echo (!empty($options['portfolio-sortable-text'])) ? $options['portfolio-sortable-text'] : __('Sort Portfolio',NECTAR_THEME_NAME); ?></span> <i class="icon-angle-down"></i></a>

<ul>
<li><a href="#" data-filter="*"><?php echo __('All', NECTAR_THEME_NAME); ?></a></li>
<?php wp_list_categories(array('title_li' => '', 'taxonomy' => 'project-type', 'show_option_none' => '', 'walker' => new Walker_Portfolio_Filter())); ?>
</ul>
</div>
<?php } ?>

</div>
</div>

</div>

<?php } else if(is_category() || is_tag() || is_date() || is_author() ) {

/*blog archives*/
$archive_bg_img = (isset($options['blog_archive_bg_image'])) ? nectar_options_img($options['blog_archive_bg_image']) : null;
$t_id = get_cat_ID( single_cat_title( '', false ) ) ;
$terms = get_option( "taxonomy_$t_id" );

$heading = null;
$subtitle = null;

if(is_author()){

$heading = get_the_author();
$subtitle = __('All Posts By', NECTAR_THEME_NAME );

} else if(is_category()) {

$heading = single_cat_title( '', false );
$subtitle = __('Category', NECTAR_THEME_NAME );

} else if(is_tag()) {

$heading = wp_title("",false);
$subtitle = __('Tag', NECTAR_THEME_NAME );

} else if(is_date()){

if ( is_day() ) :

$heading = get_the_date();
$subtitle = __('Daily Archives', NECTAR_THEME_NAME );

elseif ( is_month() ) :

$heading = get_the_date( _x( 'F Y', 'monthly archives date format', NECTAR_THEME_NAME ) );
$subtitle = __('Monthly Archives', NECTAR_THEME_NAME );

elseif ( is_year() ) :

$heading = get_the_date( _x( 'Y', 'yearly archives date format', NECTAR_THEME_NAME ) );
$subtitle = __('Yearly Archives', NECTAR_THEME_NAME );

else :
$heading = __( 'Archives', NECTAR_THEME_NAME );

endif;
} else {
$heading = wp_title("",false);
} ?>


<?php
if(!empty($terms['category_image']) || !empty($archive_bg_img)) {

$bg_img = $archive_bg_img;
if(!empty($terms['category_image'])) $bg_img = $terms['category_image'];

if($animate_in_effect == 'slide-down') {
$wrapper_height_style = null;
} else {
$wrapper_height_style = 'style="height: 350px;"';
}
?>

<div id="page-header-wrap" data-midnight="light" <?php echo $wrapper_height_style; ?>>
<div id="page-header-bg" data-animate-in-effect="<?php echo $animate_in_effect; ?>" id="page-header-bg" data-text-effect="" data-bg-pos="center" data-alignment="left" data-alignment-v="center" data-parallax="0" data-height="350" style="height: 350px;">

<div class="page-header-bg-image" style="background-image: url(<?php echo $bg_img; ?>);"></div>

<div class="container">
<div class="row">
<div class="col span_6">
<div class="inner-wrap">
<span class="subheader"><?php echo $subtitle; ?></span>
<h1><?php echo $heading; ?></h1>
</div>

</div>
</div>

</div>
</div>

</div>
<?php } else { ?>


<div class="row page-header-no-bg" data-alignment="<?php echo (!empty($text_align)) ? $text_align : 'left' ; ?>">
<div class="container">
<div class="col span_12 section-title">
<span class="subheader"><?php echo $subtitle; ?></span>
<h1><?php echo $heading; ?></h1>
<?php /*//BK*/ if ( category_description() ) { echo '<div>'.category_description().'</div>'; } ?>
</div>
</div>

</div>


<?php }
}

}
}

Displaying The Category Description On Single Posts

Create a single.php text file in root of the child theme, if you have not already started using a child theme single.php file.

From the parent theme directory, open the single.php file copy all the code into the single.php file in the child theme

In version 7.0.8 of the Salient theme, there are about 315 lines of code in the single.php file.

On about line 86 find the following code.

<span class="meta-category">

<?php $categories = get_the_category();
if ( ! empty( $categories ) ) {
$output = null;
foreach( $categories as $category ) {
$output .= '<a class="'.$category->slug.'" href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', NECTAR_THEME_NAME), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>';
}
echo trim( $output);
} ?>
</span>

After the closing </span> tag on about line 97, enter the following code to display the category description under the category name on single posts.

<?php /*//BK*/ if ( category_description() ) { echo '<div>'.category_description().'</div>'; } ?>

This will display the category description for the Blog Header Type with Variable Height Minimal.

If you search the code in the single.php for where the post title/heading or the post meta (author, date, etc) are displayed then you should find the other Blog styles where you can add the above code to display the category description.

The following CSS above (for formatting the category description display on category archives) will also format the style for the category description for the Blog Header Type with Variable Height Minimal.

For other Blog Header Types, you may need to add a class to the above div tag and then CSS can be added to wp-admin > Salient > General Settings > CSS/Script Related to customise the display of category description text that appears for other Blog Header Types.

The full code in the single.hp file to display the category description on single posts.

<?php get_header(); ?>

<?php

global $nectar_theme_skin, $options;

$bg = get_post_meta($post->ID, '_nectar_header_bg', true);
$bg_color = get_post_meta($post->ID, '_nectar_header_bg_color', true);
$fullscreen_header = (!empty($options['blog_header_type']) && $options['blog_header_type'] == 'fullscreen' && is_singular('post')) ? true : false;
$blog_header_type = (!empty($options['blog_header_type'])) ? $options['blog_header_type'] : 'default';
$fullscreen_class = ($fullscreen_header == true) ? "fullscreen-header full-width-content" : null;
$theme_skin = (!empty($options['theme-skin']) && $options['theme-skin'] == 'ascend') ? 'ascend' : 'default';
$hide_sidebar = (!empty($options['blog_hide_sidebar'])) ? $options['blog_hide_sidebar'] : '0';
$blog_type = $options['blog_type'];

if(have_posts()) : while(have_posts()) : the_post();

nectar_page_header($post->ID);

endwhile; endif;



if($fullscreen_header == true) {

if(empty($bg) && empty($bg_color)) { ?>
<div class="not-loaded default-blog-title fullscreen-header" id="page-header-bg" data-midnight="light" data-alignment="center" data-parallax="0" data-height="450" style="height: 450px;">
<div class="container">
<div class="row">
<div class="col span_6 section-title blog-title">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="author-section">
<span class="meta-author vcard author">
<?php if (function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), 100 ); }?>
</span>
<div class="avatar-post-info">
<span class="fn"><?php the_author_posts_link(); ?></span>
<span class="meta-date date updated"><i><?php echo get_the_date(); ?></i></span>
</div>
</div>
</div>
</div>
</div>
<?php
$button_styling = (!empty($options['button-styling'])) ? $options['button-styling'] : 'default';
if($button_styling == 'default'){
echo '<div class="scroll-down-wrap"><a href="#" class="section-down-arrow"><i class="icon-salient-down-arrow icon-default-style"> </i></a></div>';
} else {
echo '<div class="scroll-down-wrap"><a href="#" class="section-down-arrow"><i class="fa fa-angle-down top"></i><i class="fa fa-angle-down"></i></a></div>';
}
?>
</div>
<?php }


if($theme_skin != 'ascend') { ?>
<div class="container">
<div id="single-below-header" class="<?php echo $fullscreen_class; ?> custom-skip">
<span class="meta-share-count"><i class="icon-default-style steadysets-icon-share"></i> <?php echo '<a href=""><span class="share-count-total">0</span> <span class="plural">'. __('Shares',NECTAR_THEME_NAME) . '</span> <span class="singular">'. __('Share',NECTAR_THEME_NAME) .'</span></a>'; nectar_blog_social_sharing(); ?> </span>
<span class="meta-category"><i class="icon-default-style steadysets-icon-book2"></i> <?php the_category(', '); ?></span>
<span class="meta-comment-count"><i class="icon-default-style steadysets-icon-chat-3"></i> <a href="<?php comments_link(); ?>"><?php comments_number( __('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME) ); ?></a></span>
</div><!--/single-below-header-->
</div>

<?php }

} ?>





<div class="container-wrap <?php echo ($fullscreen_header == true) ? 'fullscreen-blog-header': null; ?> <?php if($blog_type == 'std-blog-fullwidth' || $hide_sidebar == '1') echo 'no-sidebar'; ?>">

<div class="container main-content">

<?php if(get_post_format() != 'quote' && get_post_format() != 'status' && get_post_format() != 'aside') { ?>

<?php if(have_posts()) : while(have_posts()) : the_post();

if((empty($bg) && empty($bg_color)) && $fullscreen_header != true) { ?>

<div class="row heading-title" data-header-style="<?php echo $blog_header_type; ?>">
<div class="col span_12 section-title blog-title">
<?php if($blog_header_type == 'default_minimal') { ?>
<span class="meta-category">

<?php $categories = get_the_category();
if ( ! empty( $categories ) ) {
$output = null;
foreach( $categories as $category ) {
$output .= '<a class="'.$category->slug.'" href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', NECTAR_THEME_NAME), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>';
}
echo trim( $output);
} ?>
</span>
<?php /*//BK*/ if ($categories[0]->description) { echo '<div>'.($categories[0]->description).'</div>'; } ?>

</span> <?php } ?>
<h1 class="entry-title"><?php the_title(); ?></h1>

<div id="single-below-header">
<?php //BK <span class="meta-author vcard author"><span class="fn"><?php echo __('By', NECTAR_THEME_NAME); ?> <?php //BK the_author_posts_link(); ?><?php //BK </span></span> ?><!--
--><span class="meta-date date updated">&nbsp;&nbsp;&nbsp;<?php echo get_the_date(); ?></span><!--
--><?php if($blog_header_type != 'default_minimal') { ?><span class="meta-category"><?php the_category(', '); ?></span> <?php } else { ?><!--
--><span class="meta-comment-count"><?php if(function_exists('pvc_post_views')) { echo strip_tags(pvc_post_views(0,false)); } ?> Views</span>
<span class="meta-comment-count"><a href="<?php comments_link(); ?>"> <?php comments_number( __('No Comments >>', NECTAR_THEME_NAME), __('One Comment >>', NECTAR_THEME_NAME), __('% Comments >>', NECTAR_THEME_NAME) ); ?></a></span>
<?php } ?>
</ul><!--project-additional-->
</div><!--/single-below-header-->

<?php if($blog_header_type != 'default_minimal') { ?>
<div id="single-meta" data-sharing="<?php echo ( !empty($options['blog_social']) && $options['blog_social'] == 1 ) ? '1' : '0'; ?>">
<ul>

<li class="meta-comment-count">
<a href="<?php comments_link(); ?>"><i class="icon-default-style steadysets-icon-chat"></i> <?php comments_number( __('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME) ); ?></a>
</li>

<li>
<?php echo '<span class="n-shortcode">'.nectar_love('return').'</span>'; ?>
</li>

<?php if( !empty($options['blog_social']) && $options['blog_social'] == 1 ) {

echo '<li class="meta-share-count"><a href="#"><i class="icon-default-style steadysets-icon-share"></i><span class="share-count-total">0</span></a> <div class="nectar-social">';


//facebook
if(!empty($options['blog-facebook-sharing']) && $options['blog-facebook-sharing'] == 1) {
echo "<a class='facebook-share nectar-sharing' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-facebook'></i> <span class='count'></span></a>";
}
//twitter
if(!empty($options['blog-twitter-sharing']) && $options['blog-twitter-sharing'] == 1) {
echo "<a class='twitter-share nectar-sharing' href='#' title='".__('Tweet this', NECTAR_THEME_NAME)."'> <i class='icon-twitter'></i> <span class='count'></span></a>";
}
//google plus
if(!empty($options['blog-google-plus-sharing']) && $options['blog-google-plus-sharing'] == 1) {
echo "<a class='google-plus-share nectar-sharing-alt' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-google-plus'></i> <span class='count'> ".GetGooglePlusShares(get_permalink($post->ID))." </span></a>";
}

//linkedIn
if(!empty($options['blog-linkedin-sharing']) && $options['blog-linkedin-sharing'] == 1) {
echo "<a class='linkedin-share nectar-sharing' href='#' title='".__('Share this', NECTAR_THEME_NAME)."'> <i class='icon-linkedin'></i> <span class='count'> </span></a>";
}
//pinterest
if(!empty($options['blog-pinterest-sharing']) && $options['blog-pinterest-sharing'] == 1) {
echo "<a class='pinterest-share nectar-sharing' href='#' title='".__('Pin this', NECTAR_THEME_NAME)."'> <i class='icon-pinterest'></i> <span class='count'></span></a>";
}

echo '</div></li>';

}
?>



</ul>


</div><!--/single-meta-->

<?php } ?>
</div><!--/section-title-->
</div><!--/row-->

<?php }

endwhile; endif; ?>

<?php } ?>

<div class="row">

<?php

if ( function_exists( 'yoast_breadcrumb' ) ){ yoast_breadcrumb('<p id="breadcrumbs">','</p>'); }

$options = get_nectar_theme_options();

global $options;

if($blog_type == 'std-blog-fullwidth' || $hide_sidebar == '1'){
echo '<div id="post-area" class="col span_12 col_last">';
} else {
echo '<div id="post-area" class="col span_9">';
}

if(have_posts()) : while(have_posts()) : the_post();


if ( floatval(get_bloginfo('version')) < "3.6" ) {
//old post formats before they got built into the core
get_template_part( 'includes/post-templates-pre-3-6/entry', get_post_format() );
} else {
//WP 3.6+ post formats
get_template_part( 'includes/post-templates/entry', get_post_format() );
}

endwhile; endif;

wp_link_pages();


global $options;

if($theme_skin != 'ascend') {
if( !empty($options['author_bio']) && $options['author_bio'] == true){
$grav_size = 80;
$fw_class = null;
?>

<div id="author-bio" class="<?php echo $fw_class; ?>">
<div class="span_12">
<?php if (function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), $grav_size ); }?>
<div id="author-info">
<h3><span><?php if(!empty($options['theme-skin']) && $options['theme-skin'] == 'ascend') { _e('Author', NECTAR_THEME_NAME); } else { _e('About', NECTAR_THEME_NAME); } ?></span> <?php the_author(); ?></h3>
<p><?php the_author_meta('description'); ?></p>
</div>
<?php if(!empty($options['theme-skin']) && $options['theme-skin'] == 'ascend'){ echo '<a href="'. get_author_posts_url(get_the_author_meta( 'ID' )).'" data-hover-text-color-override="#fff" data-hover-color-override="false" data-color-override="#000000" class="nectar-button see-through-2 large"> '. __("More posts by",NECTAR_THEME_NAME) . ' ' .get_the_author().' </a>'; } ?>
<div class="clear"></div>
</div>
</div>

<?php } ?>

<div class="comments-section">
<?php comments_template(); ?>
</div>


<?php } ?>

<?php if($blog_header_type == 'default_minimal') { ?>

<div class="bottom-meta">
<?php
echo '<div class="sharing-default-minimal">';
nectar_blog_social_sharing();
echo '</div>'; ?>
</div>
<?php } ?>


</div><!--/span_9-->

<?php if($blog_type != 'std-blog-fullwidth' && $hide_sidebar != '1') { ?>

<div id="sidebar" class="col span_3 col_last">
<?php get_sidebar(); ?>
</div><!--/sidebar-->


<?php } ?>


</div><!--/row-->



<!--ascend only author/comment positioning-->
<div class="row">

<?php if($theme_skin == 'ascend' && $fullscreen_header == true) { ?>

<div id="single-below-header" class="<?php echo $fullscreen_class; ?> custom-skip">
<span class="meta-share-count"><i class="icon-default-style steadysets-icon-share"></i> <?php echo '<a href=""><span class="share-count-total">0</span> <span class="plural">'. __('Shares',NECTAR_THEME_NAME) . '</span> <span class="singular">'. __('Share',NECTAR_THEME_NAME) .'</span> </a>'; nectar_blog_social_sharing(); ?> </span>
<span class="meta-category"><i class="icon-default-style steadysets-icon-book2"></i> <?php the_category(', '); ?></span>
<span class="meta-comment-count"><i class="icon-default-style steadysets-icon-chat-3"></i> <a class="comments-link" href="<?php comments_link(); ?>"><?php comments_number( __('No Comments', NECTAR_THEME_NAME), __('One Comment ', NECTAR_THEME_NAME), __('% Comments', NECTAR_THEME_NAME) ); ?></a></span>
</div><!--/single-below-header-->

<?php }

if($theme_skin == 'ascend') nectar_next_post_display(); ?>

<?php if( !empty($options['author_bio']) && $options['author_bio'] == true && $theme_skin == 'ascend'){
$grav_size = 80;
$fw_class = 'full-width-section ';
$next_post = get_previous_post();
$next_post_button = (!empty($options['blog_next_post_link']) && $options['blog_next_post_link'] == '1') ? 'on' : 'off';
?>

<div id="author-bio" class="<?php echo $fw_class; if(empty($next_post) || $next_post_button == 'off' || $fullscreen_header == false && $next_post_button == 'off') echo 'no-pagination'; ?>">
<div class="span_12">
<?php if (function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), $grav_size ); }?>
<div id="author-info">
<h3><span><?php if(!empty($options['theme-skin']) && $options['theme-skin'] == 'ascend') { echo '<i>' . __('Author', NECTAR_THEME_NAME) . '</i>'; } else { _e('About', NECTAR_THEME_NAME); } ?></span> <?php the_author(); ?></h3>
<p><?php the_author_meta('description'); ?></p>
</div>
<?php if(!empty($options['theme-skin']) && $options['theme-skin'] == 'ascend'){ echo '<a href="'. get_author_posts_url(get_the_author_meta( 'ID' )).'" data-hover-text-color-override="#fff" data-hover-color-override="false" data-color-override="#000000" class="nectar-button see-through-2 large">' . __("More posts by",NECTAR_THEME_NAME) . ' ' . get_the_author().' </a>'; } ?>
<div class="clear"></div>
</div>
</div>

<?php } ?>


<?php if($theme_skin == 'ascend') { ?>

<div class="comments-section" data-author-bio="<?php if(!empty($options['author_bio']) && $options['author_bio'] == true) { echo 'true'; } else { echo 'false'; } ?>">
<?php comments_template(); ?>
</div>

<?php } ?>

</div>


<?php if($theme_skin != 'ascend') nectar_next_post_display(); ?>

</div><!--/container-->

</div><!--/container-wrap-->

<?php get_footer(); ?>

See before and after…

Before:

After:


Originally published at Bharat Karavadra.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.