Forum Replies Created
- AuthorPosts
- shapParticipant
How to remove “Category:” from category title
It’s easy to do that. Simply open the functions.php file in your theme and add the following code at the end of the file:function prefix_category_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( ”, false );
}
return $title;
}
add_filter( ‘get_the_archive_title’, ‘prefix_category_title’ );Now refresh your category pages and you will see “Category: ” is gone.
shapParticipantI insert in wp-content/themes/hashone/template-parts/content-single.php:
<?php
/**
* Template part for displaying single posts.
*
* @package HashOne
*/?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<!– INSERT –>
<?php if ( ‘post’ == get_post_type() ) : ?>
<div class=”entry-meta hs-post-info”>
<?php hashone_posted_on(); ?>
</div><!– .entry-meta –>
<?php endif; ?><div class=”hs-post-wrapper”>
<?php if(has_post_thumbnail()): ?>
<figure class=”entry-figure”>
<?php
$hashone_image = wp_get_attachment_image_src( get_post_thumbnail_id() , ‘hashone-blog-header’ );
?>
” alt=”<?php echo esc_attr( get_the_title() ) ?>”>
</figure>
<?php endif; ?><header class=”entry-header”>
<?php the_title( sprintf( ‘<h3 class=”entry-title”>’, esc_url( get_permalink() ) ), ‘</h3>’ ); ?>
</header><!– .entry-header –><div class=”entry-categories”>
<?php echo hashone_entry_category(); ?>
</div>
<!– end INSERT –><div class=”entry-content”>
<?php the_content(); ?>
<?php
wp_link_pages( array(
‘before’ => ‘<div class=”page-links”>’ . esc_html__( ‘Pages:’, ‘hashone’ ),
‘after’ => ‘</div>’,
) );
?>
</div><!– .entry-content –>
</div></article><!– #post-## –>
- AuthorPosts