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

WordPress i18n-friendly preg_replace post title

We can use the protected_title_format and private_title_format filters, available since WordPress version 2.8: add_filter( ‘protected_title_format’, ‘wpse_pure_title’, 10, 2 ); add_filter( ‘private_title_format’, ‘wpse_pure_title’, 10, 2 ); function wpse_pure_title( $format, \WP_Post $post ) { return ‘mycpt’ === get_post_type( $post ) ? ‘%s’ : $format; } to get rid of the “Private:” and “Protected:” parts on the front-end … Read more

How can I hook into the post editor title field in order to change the HTML?

There is no hook to change the HTML of the input (only the enter_title_here filter to change the placeholder text). You could pull this off easily with jQuery, though. Try this in your functionality plugin or theme’s functions.php file: // Add to the new post screen for any post type add_action( ‘admin_footer-post-new.php’, ‘wpse_add_required_attr_to_title_field’ ); // … Read more

How to get page’s ID if I know the title only?

I’m not sure how to get it via the title, but you can get it via the slug (which is often more useful in my experience) using this: http://erikt.tumblr.com/post/278953342/get-a-wordpress-page-id-with-the-slug Just change “$page” to “$post” if you want to return slugs for posts instead of pages. G’luck!

Change page title from plugin

There’s a filter for that: function wpse_alter_title( $title, $id ) { // $id = $post->ID; // alter the title here return $title; } If you want to alter the “Protected” and “Private” titles, then you need other filters: // Preserve the “%s” – else the title will be removed. function wpse_alter_protected_title_format( $title ) { return … Read more

Changing “Enter title here” based on post format

You need to do the following; jQuery(document).ready(function( $ ) { $(‘input.post-format’).click(function(){ $(‘#title-prompt-text’).val( $(this).next(‘label’).text()); }) }); This will replace the title with whichever post format you select. Save the above into a file called custom-post-title.js and you will need to place this file into your theme folder. Either in the root or within a folder named … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)