Setting title using wp_title filter

Since wp_title() is usually called from the header.php file of your theme, then it runs on every page of your WordPress (frontend usually). So place the filter hook and function in your theme’s functions.php file, and just check if it’s a blog post before you change the title. Something like this: add_filter(‘wp_title’, ‘filter_pagetitle’); function filter_pagetitle($title) … Read more

Customise Jetpack Publicize text

Just some general remarks: Why isn’t the following change working? $custom_message = get_the_title( $post->ID ) .”. $hash_tags; to: $custom_message = get_the_content( $post->ID ) .’ ‘. $hash_tags; Note that get_the_content() doesn’t take a post ID as an input parameter and it depends on global variables, like $pages that’s derived from $post->post_content (with some pagination adjustments), within … Read more

How can I reliably and globally disable wptexturize?

Plugins will be able to re-enable any filter you have switched off, if they do so after you are finished. So the trick is to make sure you are the last one to do something with this filter by setting a high number, low priority on it. add_filter( ‘run_wptexturize’, ‘__return_false’, 9999 );

get_the_excerpt() with fallback like the_excerpt()

The function the_excerpt() is only a echo of the function get_the_excerpt(): function the_excerpt() { echo apply_filters(‘the_excerpt’, get_the_excerpt()); } If you like a fall back for no input the excerpt meta box, then create a text from the content – get_the_content(). You can use the core function wp_trim_words() for set the counter for words and easy … Read more

Add ‘if exists’ to filter

You want has_post_thumbnail. add_filter( ‘the_content’, insert_featured_image, 20 ); function insert_featured_image( $content ) { global $post; if (has_post_thumbnail($post->ID)) { $content = preg_replace( “/<\/p>/”, “</p>” . get_the_post_thumbnail($post->ID, ‘post-single’), $content, 1 ); } return $content; } Note: The code above is from the post referenced in the OP, but with the has_post_thumbnail conditional. I also had to add … Read more

Cron schedule interval through plugin options?

Yes, in my opinion that’s exactly the right way to extend the default schedule timings. I would be a little more informative with the display value but I think that is only example code. However, one important thing should be taken into account. The default WordPress schedule implementation that is invoked as a side effect … Read more

wp_link_pages output appears twice

you need to set the ‘echo’ parameter of wp_link_pages() to ‘echo=0’; example: $content .= ‘<div class=”pagination”>’ . wp_link_pages(‘before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous&echo=0’) . ‘</div>’;