Empty title on front page/Home

The title is empty at the front page in WordPress. Yes, that sucks. Just put the separator into wp_title(): <title><?php // separator, print immediately, separator position wp_title( ‘·’, TRUE, ‘right’ ); bloginfo( ‘name’ ); ?></title> This prints out just the blog name on the front page and PAGE NAME · BLOG NAME on other pages.

Fill post titles from post content?

Hook into the_post – called when the post is actually used – and fill the title. Be aware the slug has to be changed too. If you are used not to enter a title, hook into save_post too, and let the same code do this for you. The code Download on GitHub <?php /** * … Read more

Modify page title format (when using title-tag)

If you’re using the Yoast SEO plugin (which it looks like you are) then this answer might help you If you are using yoast SEO plugin then the easiest method is to remove the archive word from “titles & metas-> Taxonomies->category” find: %%term_title%% Archives %%page%% %%sep%% %%sitename%% replace it with: %%term_title%% %%page%% %%sep%% %%sitename%% Alternatively … Read more

the_title filter applying to menu items

Use in_the_loop() conditional tag to make sure you are modifying the title inside the Loop and to prevent the hook changing titles somewhere else: function customize_wishlist_title( $title ){ $current_user = wp_get_current_user(); $loggeduser = $current_user->user_login; // give attention to the following condition: if ( is_page( 258 ) && in_the_loop() ) { $title=”<span class=”username”>”.$loggeduser.’\’s’.'</span>’.’&nbsp;’.'<span>Wishlist</span>’; } return $title; … Read more

add_theme_support( ‘title-tag’ ) in conflict with custom titles function

Your problem is that you can not use wp_title() in the theme if the theme already supports title-tag. The <head> of your theme should look like this: <head> <meta charset=”<?php bloginfo( ‘charset’ ); ?>”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <?php wp_head(); ?> </head> The filter and title-tag support: add_action( ‘after_setup_theme’, ‘theme_functions’ ); function theme_functions() { add_theme_support( … Read more

How to add subscript and superscript in WordPress page titles

You can use markup in titles. H<sub>2</sub>O will work just fine. I would use H₂O with a real ₂ because markup will be stripped in title attributes and in feeds. Note that WordPress will not create a pretty permalink for the correct character. The slug for my example will look like this: h2o-h%e2%82%82o. You need … Read more

order by second word in title?

There is a filter, ‘posts_orderby’, which allows you to specify your own ORDER BY clauses. In your case, the code would look something like this: add_filter( ‘posts_orderby’, ‘order_by_surname’ ); function order_by_surname( $orderby, $query ) { // first you should check to make sure sure you’re only filtering the particular query // you want to hack. … Read more

Problem in wordpress with “-“

Background: WordPress converts normal dash (-) to long dash (–), straight quotes to curly quotes and some other similar symbols and punctuations to their printer friendly versions using wptexturize. Generally it’s recommended to leave them up to WordPress. However, occasionally, we may want to override this behaviour. For example, in case we are writing Programming … Read more

How can I add title attributes to next and previous post link functions?

Update As I deleted the Repo on GitHub, here’s a new answer. add_filter( ‘previous_post_link”https://wordpress.stackexchange.com/questions/13044/,”wpse13044_adjacent_post_link_tooltip’, 10, 2 ); add_filter( ‘next_post_link”https://wordpress.stackexchange.com/questions/13044/,”wpse13044_adjacent_post_link_tooltip’, 10, 2 ); function wpse13044_adjacent_post_link_tooltip( $format, $link ) { $previous=”previous_post_link” === current_filter(); // Get the next/previous post object $post = get_adjacent_post( false ,” ,$previous ); // Copypasta from cores `get_adjacent_post_link()` fn ” === $title = get_the_title( … Read more

Two title tags in my header

The two title tags can be explained as that you are using a theme that is written for WordPress4.1 and actually is using 4.1. As from 4.1 you don’t need to call wp_title() in the head any more, you can make use of new title_tag theme support tag which automatically adds the wp_title() tag in … Read more