How to remove title attribute from gallery links and images

I’ve found a solution : // Remove <img> 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 <a> 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

How to change wordpress post title?

add_filter(‘the_title’, ‘wordpress_title’); function wordpress_title($title){ //Return new title if called inside loop if ( in_the_loop() ) return ‘New title’; //Else return regular return $title; } Have you tried the in_the_loop() conditional check to return new title only if called inside loop. That means nav menu’s will not get affected.

How I check if the same post slug has not been used before publishing?

The Ajax way (a little bit dirty, but you can easily enhance it) In your functions.php (or in a plugin, or every where else) : function my_ajax_update(){ if (isset($_POST[‘title’])){ global $wpdb; $title = esc_sql($_POST[‘title’]); if(!$title) return; $page = $wpdb->get_results(” SELECT * FROM $wpdb->posts WHERE post_title LIKE ‘$title’ AND post_type=”event” AND post_status=”publish” LIMIT 1 “); if … Read more

Alter only the page title, not the post titles within

I believe that the page title you are talking about is the title from the page from the main query. the_title() filter (and the_content() filter for that matter) targets all the respective template tags regardless of query. To avoid this, target only the main query and the specific page. You can try the following inside … Read more

What is the proper filter to add html to a post / page title?

the_title is the correct hook. You can confirm that by checking the source. What you are doing is a bit odd, but it makes sense. Clever solution but I don’t think it was expected. The problem you having seems to be with this line: http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/default-widgets.php#L574 <a href=”<?php the_permalink() ?>” title=”<?php echo esc_attr( get_the_title() ? get_the_title() … Read more

Dynamically add titles to post images if they are empty

You can try the following test plugin, that uses the domDocument class, to see how it works on your HTML. It assumes PHP 5.4+ with LibXML 2.7.8+. <?php /** * Plugin Name: Add Missing Image Title Attributes * Description: For posts in the main loop (Assumes PHP 5.4+ with LibXML 2.7.8+) * Plugin URI: http://wordpress.stackexchange.com/a/188560/26350 … Read more

Adding HTML within an image title attribute

First of all i’d recommend you stop using title attribute for html container purpose: Image title (and the element name speaks for itself) should provide additional information and follow the rules of the regular title: it should be relevant, short, catchy, and concise (a title “offers advisory information about the element for which it is … Read more

How to customize search result page title?

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 &#8220;%s&#8221;’ ), get_search_query() ); so you could hook into the document_title_parts filter to adjust it to your neds. Example: … Read more