How do I get rid of the vertical bar in the url

This will be in your header.php, something like: <title><?php bloginfo(‘name’); ?> | <?php wp_title(); ?></title> Just change the vertical line to be included in the conditional, so that it shows on the other pages but not on the homepage, such as: <title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?>| <?php } ?> <?php … Read more

The tags can only contain a call to wp_title(). Use the wp_title filter to modify the output

add_theme_support( ‘title-tag’ ) doesn’t belong in your header template. It belongs in your functions.php file. Usually, it’s best to wrap it in it’s own function and hook it to after_setup_theme in order to allow plugins and child themes to override it later if they need to. So… function wpse_add_title_support() { add_theme_support( ‘title-tag’ ); } add_action … Read more

How do I fix title? [closed]

Usage of wp_title() is not recommended anymore. Instead, you can add the title-tag support to your theme, so WordPress can automatically build and output the proper title for you. Here’s how to do it: add_action( ‘after_setup_theme’, ‘wpse302145_add_title_tag’ ); function wpse302145_add_title_tag() { add_theme_support( ‘title-tag’ ); } This piece of code goes in your theme/child-theme’s functions.php file. … Read more

wp_title() shows 404 – installation outside WP

You could do an outside query instead. <?php define(‘WP_USE_THEMES’, false); global $wpdb; require(ROOT_DIR.’/blog/wp-load.php’); query_posts(‘showposts=1’); get_header(); try{ $args = array(‘post_type’ => array(‘post’), ‘posts_per_page’ => -1); $qry = null; $qry = new WP_Query($args); if($qry->have_posts()){ while($qry->have_posts()){ $qry->the_post(); $theTitle = get_the_title(); print $theTitle.'<br>’; } wp_reset_query(); }else{ print ‘no records found’; } }catch(Exception $e){ print $e->getMessage(); } get_footer(); ?>

Html title best practices and usage (wp_title, title-tag support, etc..)?

Do you have any SEO plugins installed? They usually fiddle with this logic. Having Yoast enabled, the pre_get_document_title does not work for me, instead you should use wpseo_title per their documentation. Having said that, with SEO plugins disabled and add_theme_support(‘title-tag’); enabled, the pre_get_document_title filter works for me without any problem. add_action(‘after_setup_theme’, function () { add_theme_support(‘title-tag’); … Read more

Change the output of wp_title()

Take a look in header.php of your theme. Some themes have the title output like this: <title><?php wp_title(‘|’, true, ‘right’); ?> | <?php echo get_bloginfo(‘name’) ?></title> So you’ll have to remove the | <?php echo get_bloginfo(‘name’) ?> part. However you should keep the title of the site in the <title> for SEO purposes.