Aleš Sýkora wrote

Remove Archive Title prefix in WordPress

28. 5. 2021 in

Put this code in code snippets plugin.

  add_filter( 'get_the_archive_title', 'my_theme_archive_title' );
/**
 * Remove archive labels.
 * 
 * @param  string $title Current archive title to be displayed.
 * @return string        Modified archive title to be displayed.
 */
function my_theme_archive_title( $title ) {
	if ( is_category() ) {
		$title = single_cat_title( '', false );
	} elseif ( is_tag() ) {
		$title = single_tag_title( '', false );
	} elseif ( is_author() ) {
		$title = '<span class="vcard">' . get_the_author() . '</span>';
	} elseif ( is_post_type_archive() ) {
		$title = post_type_archive_title( '', false );
	} elseif ( is_tax() ) {
		$title = single_term_title( '', false );
	} elseif ( is_home() ) {
		$title = single_post_title( '', false );
	}

	return $title;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
How to ignore sticky posts in Oxygen repeater?
6. 9. 2021 in
If you create WordPress query with Oxygen Builder’s repeater element, then you propably want to ignore sticky posts sometimes. This is how you can do that with advanced query builder. You have two options of ignoring sticky posts: Ignore them from display pinned on the top, but display them in results of query Do not […]
Read More
Aleš Sýkora wrote
Child posts menu for custom post type parent item
1. 2. 2021 in
This code will help you display menu of childs on current post. For example: Product 1 = parent has those child pages: – Product usage– How to– Disclaimer– Calculator When you put this child items menu in your template, it will show all childs of product 1 on all child pages and also on product […]
Read More
Aleš Sýkora wrote
Auto login after creating new user with Toolset user form
11. 7. 2019 in
Snippet from our fan.
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram