Tag Info

Hot answers tagged

6

It looks like your site's title is empty. Fill it out or try for example: add_filter( 'wp_title', function( $title ) { return trim( $title ); } ); to remove the blank space in front. For your setup, the following part of wp_title() is responsible for the blank space: $title = $prefix . implode( " $sep ", $title_array ); So when you're on a single ...


3

From the Codex If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage: add_filter( 'wp_title', 'baw_hack_wp_title_for_home' ); function baw_hack_wp_title_for_home( $title ) { if( empty( $title ) ...


3

Your problem is that you can not use wp_title() in the theme if the theme already supports title-tag. The <head> of your theme should look like this: <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <?php wp_head(); ?> </head> ...


2

I've found a solution, so I'm sure it will be useful for others. First: custom titles Explanation: If my custom_titles() function is enabled, load the function in functions.php under the after_theme_setup priority 2, and show the title tags in the header.php file. In functions.php: if ( ot_get_option( 'enable_custom_titles' ) === 'on' ) { // The ...


2

the_title() calls your function again. If you want to avoid that, remove the callback inside of your function: function filter_title_after() { remove_filter( current_filter(), __FUNCTION__ ); // the rest of your code. But you shouldn’t call the_title() in your function at all: it prints the title – this is not what you want – and you get the ...


1

You can make use of properties on elements. Have a look at the following concept and see if you can use it. You basically hide all "featured" images. Add a general class to the post titles which you want to use to show/hide images. Add a property to the post title element which holds the id of the image you want to show. Generated MarkUp: <img ...


1

You may want to filter out the title. add_filter( 'wp_title', 'wpse179527_wp_title' ); function wpse179527_wp_title( $title ) { global $post; if ( is_single() && 'custom-post' == get_post_type( $post ) ) return ''; return $title; }


1

First, let's change your <title> to <title><?php wp_title(' | ', true, 'right'); ?></title> Because adding to the title string in that was isn't very future-forward, instead it's best to use a filter to do any modifications to the title. So let's instead ad (in functions.php): add_filter('wp_title', 'my_custom_title'); function ...


1

Set the display argument of the function to false. <h2> <?php if (is_category()){ echo 'Category: ' . single_cat_title( '', false); } ?> </h2> Or, to use the function in its more "helpful" form you could do: single_cat_title('Category: '); If the display argument is true, WordPress automatically ...


1

Try this to create your custom titles. remove_filter( 'wp_title', 'genesis_default_title', 10, 3 ); //Default title remove_action( 'genesis_site_title', 'genesis_seo_site_title' ); //Genesis Extra Stuff remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); //Genesis Extra Stuff add_filter( 'wp_title', 'genesis_default_title_new', 10, ...



Only top voted, non community-wiki answers of a minimum length are eligible