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

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

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