Skip to main content
added 48 characters in body
Source Link
Amine Faiz
  • 384
  • 1
  • 6

You can use it that way :

function add_suffix_to_title($title, $id = null){
    returnif '<h1(! class="main-title"is_admin()) >'{
        return '<h1>'.$title.'</h1> Your Suffix';
    }
    return $title;
}

add_action( 'the_title', 'add_suffix_to_title', 10, 1 );

And when you invoke the "the_title" function remove the h1 tag :

the_title();

I hope that would help you.

You can use it that way :

function add_suffix_to_title($title){
    return '<h1 class="main-title" >'.$title.'</h1> Your Suffix';
}

add_action( 'the_title', 'add_suffix_to_title', 10, 1 );

And when you invoke the "the_title" function remove the h1 tag :

the_title();

I hope that would help you.

You can use it that way :

function add_suffix_to_title($title, $id = null){
    if (! is_admin()) {
        return '<h1>'.$title.'</h1> Your Suffix';
    }
    return $title;
}

add_action( 'the_title', 'add_suffix_to_title', 10, 1 );

And when you invoke the "the_title" function remove the h1 tag :

the_title();

I hope that would help you.

Source Link
Amine Faiz
  • 384
  • 1
  • 6

You can use it that way :

function add_suffix_to_title($title){
    return '<h1 class="main-title" >'.$title.'</h1> Your Suffix';
}

add_action( 'the_title', 'add_suffix_to_title', 10, 1 );

And when you invoke the "the_title" function remove the h1 tag :

the_title();

I hope that would help you.