how can I use the names of the wordpress pages as header text?

0

Good, I am trying that in each wordpress page instead of leaving in the header the text that appears in the home page, the name of the specific page appears, does anyone know if it is possible and how? I've been looking for information for days but there's no way.

    
asked by JHZ 02.02.2018 в 16:07
source

1 answer

1

If you refer to the tag, there are some plugins mainly oriented to SEO that allow changing the title for each page, entry, multimedia file among others of the possible ones, most of these plugins allow you to customize the meta tags. You can also edit in your header file of the template, locate the following tag in wp-content / mitema / header.php:

<title></title>

If there is the delete with its content and you go to your file functions.php to insert the following if it does not exist:

    if ( ! function_exists( '_wp_render_title_tag' ) ) :
     function theme_slug_render_title() {
    ?>
    <title><?php wp_title( '-', true, 'right' ); ?></title>
    <?php
    }
    add_action( 'wp_head', 'theme_slug_render_title' );
    endif;

Otherwise if it is present in the header.php or you want to add it inserted in your functions.php

  add_theme_support( 'title-tag' );

And in the header.php:

<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

The wp_title () method can be seen at link

Now if you mean a title for example that is next to the menu, logo or in a similar location possibly in the header.php file you will find something like

<div id="site-header">
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
        <?php echo esc_attr(get_bloginfo('name')); ?>
    </a>
</div>

Where you can change to:

<div id="site-header">
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
        <?php echo esc_attr(get_the_title()); ?>
    </a>
</div>    

Reference: link

    
answered by 04.02.2018 в 00:13