Short_title character problem

Use mb_strlen(), not strlen(). The same with mb_substr() and substr(): Your title contains multi-byte characters, but strlen() and substr() do not work on characters, they work on single bytes. For a improved function to shorten strings see this answer.

Remove post title

WordPress does not require entering post titles, at least not in the backend. You can leave that part of the form blank. As far as your theme is concerned, that will depend on the theme author and whether they’ve considered someone not entering a title. The default twentyeleven theme handles it fine, linking to the … Read more

Adding schema.org itemprop to WP4.1 Title Tag

If your theme is using add_theme_support(‘title-tag’), then you can try the following: remove_action( ‘wp_head’, ‘_wp_render_title_tag’, 1 ); and then just hook in your own modified version: add_action( ‘wp_head’, ‘wpse_render_title_tag_with_itemprop’, 1 ); function wpse_render_title_tag_with_itemprop() { if ( did_action( ‘wp_head’ ) || doing_action( ‘wp_head’ ) ) { printf( ‘<title itemprop=”name”>%s</title>’ . PHP_EOL, wp_title( ‘|’, false, ‘right’ ) ); … Read more

Page title not showing up

to show the page title for the page set as the ‘blog’ or ‘posts page’, you need to add some code, maybe via a filter on wp_title(); example: add_filter( ‘wp_title’, ‘wpse_174379_show_posts_page_wp_title’ ); function wpse_174379_show_posts_page_wp_title( $title ) { if( get_option( ‘page_for_posts’ ) ) { $posts_page = get_post( get_option( ‘page_for_posts’) ); $title=” ” . $posts_page->post_title . ‘ … Read more

How to echo a different title to the page if it’s opened on an android mobile phone

I’m not sure where this php_browser_info() function comes from. You can try the following instead: /** * Modify the front/home page title for Android devices */ add_filter( ‘wp_title’, function( $title ) { return ( is_front_page() || is_home() ) && isset( $_SERVER[‘HTTP_USER_AGENT’] ) && false !== stripos( $_SERVER[‘HTTP_USER_AGENT’], ‘android’ ) ? ‘Test Android’ : $title; }, PHP_INT_MAX … Read more