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’ );

How to remove title attribute from gallery links and images

I’ve found a solution : // Remove &lt;img&gt; title attribute in // http://wordpress.org/support/topic/wp_get_attachment_image_attributes-filter-not-working function remove_img_title($atts) { unset($atts[‘title’]); return $atts; } add_filter(‘wp_get_attachment_image_attributes’,’remove_img_title’, 10, 4); // remove title attribute from &lt;a&gt; title attribute in // modified from this post : http://oikos.org.uk/2011/09/tech-notes-using-resized-images-in-wordpress-galleries-and-lightboxes/ function ah_get_attachment_link_filter( $content ) { $new_content = preg_replace(‘/title=\'(.*?)\”https://wordpress.stackexchange.com/”, ”, $content ); return $new_content; } add_filter(‘wp_get_attachment_link’, ‘ah_get_attachment_link_filter’, … Read more

How to make a H1 different then the Title?

Yes! Custom fields: http://codex.wordpress.org/Custom_Fields You can create alternate post titles via the post editor, and then you can display them with some minor adjustments to the single.php and index.php templates (or {$post_type}-archive.php templates, if you have them). For example: <?php $post_title = get_post_meta($post->ID, ‘Post-Title’, true); //”Post-Title” or whatever you call your custom field if ($post_title) … Read more