Filter the blog title displayed in the header

Remove that filter/function and apply your markup in the PHP template/page file. If you need help post where you output the title. CLASS Here is how I might set this up using a class: if ( ! class_exists( ‘ThemeCustomizations’ ) ) { class ThemeCustomizations { static $inBody = false; public static function set_in_body_true() { static::$inBody … Read more

Custom Post Type with Custom Title

You can try the following code. function custom_post_type_title ( $post_id ) { global $wpdb; if ( get_post_type( $post_id ) == ‘cars’ ) { $engine=”, “.get_post_meta($post_id, ‘Engine’, true).’l’; $terms = wp_get_object_terms($post_id, ‘brand’); $abrand= ‘ ‘.$terms[0]->name; $amodel=” “.$terms[1]->name; $title = $post_id.$abrand.$amodel.$engine; $where = array( ‘ID’ => $post_id ); $wpdb->update( $wpdb->posts, array( ‘post_title’ => $title ), $where ); … Read more

Changing document title only on a custom page template

I think you will want to use the wp_title filter. Add the following to functions.php: function wpse62415_filter_wp_title( $title ) { // Return a custom document title for // the boat details custom page template if ( is_page_template( ‘boatDetails.php’ ) ) { return ‘I\’m the boat details page’; } // Otherwise, don’t modify the document title … Read more

How do I edit the tag without using the deprecated `wp_title()` function?

It looks like _wp_render_title_tag() method is what outputs the tag, and the source code in 4.8 is available here: https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/general-template.php#L1083 You can see: echo ‘<title>’ . wp_get_document_title() . ‘</title>’ . “\n”; You could first remove the action from wp_head: remove_action( ‘wp_head’, ‘_wp_render_title_tag’, 1 ); Then add your own title render method: add_action( ‘wp_head’, ‘_wp_render_title_tag_itemprop’, 1 … Read more

Custom title widget / HTML encoding

As you know, html tags doesn’t work on widget title. But there’s work around to use it. The best approach i know is to use shortcode in title. So, for using br and span, the following is a solution – add_filter(‘widget_title’, ‘do_shortcode’); add_shortcode(‘br’, ‘wpse_shortcode_br’); function wpse_shortcode_br( $attr ){ return ‘<br />’; } add_shortcode(‘span’, ‘wpse_shortcode_span’); function … Read more

How to set custom title of custom page template?

Reference Got success by adding this code to your-page-template.php file before get_header() function: function my_page_title() { return ‘Your value is ‘; // add dynamic content to this title (if needed) } add_action( ‘pre_get_document_title’, ‘my_page_title’ );