New answers tagged

0

As per the discussion the_content is not a proper hook for filtering post titles while it filters the post content. wpautop() function is called with the_content so it adds the necessary paragraphs. To filter post titles use the_title instead, it won't add any markup tags by default: echo apply_filters('the_title', get_post_field('post_title', ...


0

Dont mess with all this. Just go to the wordpress dashboard > Media, delete the titles from each picture. Done.


0

Check the add_theme_support( 'title-tag' ); https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ function theme_slug_setup() { add_theme_support( 'title-tag' ); } add_action( 'after_setup_theme', 'theme_slug_setup' ); By declaring support like this, themes acknowledge that they are not defining titles on their own and WordPress can add it ...


1

You're on a page and if we read through the list of conditionals it should hit this one specifically: elseif( ! ( is_404() ) && ( is_single() ) || ( is_page() ) ) { wp_title( '' ); echo ' - '; } It will also hit the below conditional in the next set: else { bloginfo( 'name' ); } Given page Test Page we should see Page Name - Company ...


2

You can use the_title filter. Just remember to remove it after wp_list_pages() otherwise it will effect everywhere on the site like in menu, main title, search results etc. Example:- add_filter('the_title', 'my_custom_title'); wp_list_pages(); remove_filter('the_title', 'my_custom_title'); function my_custom_title($current_title) { if ($current_title ...


0

add_filter for widget_title does not allow more than one parameter when called so the above will throw PHP warnings. This seems to work instead: function my_repair_categories_empty_title() { if ( $base == 'categories' ) { if ( trim($instance['title']) == '' ) return ''; } return $title; } add_filter('widget_title', ...


1

Within the wp_get_document_title() function we have: // If it's a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: search phrase */ $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); so you could hook into the ...



Top 50 recent answers are included