Aleš Sýkora wrote

Remove Archive Title Prefix in Astra Theme

29. 8. 2019 in

You can use this as a plugin to disable the Archive: Category: Tag: prefix in Astra Theme archives.

<?php
/**
 * Plugin Name: Remove Archive Text from the Archive Title.
 * Description: Removes the text "Archive" from funnction get_the_archive_title() of WordPress
 * Plugin URI: https://www.alessykora.cz/
 * Author: Aleš Sýkora
 * Author URI: https://www.alessykora.cz/
 * Version: 1.0.1
 * License: GPL2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

defined( 'ABSPATH' ) or exit;

add_filter( 'get_the_archive_title', 'astra_archive_title_remove_prefix_text' );

/**
 * Remove Prefix : from Archive title
 *
 * @param  string $title Default title.
 * @return string $title updated title.
 */
function astra_archive_title_remove_prefix_text( $title ) {

	if ( is_post_type_archive() ) {
        $title = post_type_archive_title( '', false );
    } elseif ( is_tax() ) {
    	$tax = get_taxonomy( get_queried_object()->taxonomy );
    	$title = single_term_title( '', false );
    } elseif ( is_category ()) {
		$title = single_cat_title( '', false);
	}

	return $title;
}

I you want to completely disable the Archive title box, use this:

// REMOVE ASTRA ARCHIVE HEADER
remove_action( 'astra_archive_header', 'astra_archive_page_info' );

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
Enable Gutenberg for Custom post type
12. 4. 2021 in
If you create Custom post type in WordPress and want to use Gutenberg editor instead of classic editor, you need to add this in your code: Here is complete example of CPT supporting Gutenberg editor.
Read More
Aleš Sýkora wrote
Show All post types in category archive with/without oxygen
28. 10. 2020 in ,
If you want to display all post types posts – the custom and default, which use the same default category as a taxonomy, you need to put this in your custom code snippets plugin an change the array to your needed post types: Normally wordpress shows only the default posts in category archive.
Read More
Aleš Sýkora wrote
Limit Toolset Form to one submission per user only
25. 6. 2021 in
The easiest way to enable user submit only one post is to hide the form when they already submitted it. So you need to count the number of posts user created and if it is more than 1 then with conditional hide the form. Check the number of posts user created with custom function 3. […]
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram