Site logo

Archived topic

Page hero template tags "tagline"

7 replies · Started by Bernhard on June 9, 2020

Viewing posts 1–8 of 8

Hello,
is it possible to address the tagline as template tag?
As I'm using polylang it would be better than creating an element for every language.

Hi there,

Sorry I don't quite understand the question.

What are you trying to achieve?

I don't see a page hero in the page you've linked.

Let me know :)

Ah sorry, the page was set to private.
I'm thinking about a new layout for the homepage and my idea is set the title tag instead of {{post_title}}.

Still don't really understand.

You can add whatever you want inside the page hero content.

If this doesn't help, can you link me to an example of what you'd like to achieve?

In my case, I have the Site Title

Rom Tourismus | Tourist in Rom | Dein Online Reiseplaner

and the Tagline

Tourist in Rom

Now I want to insert the tagline instead of <h1>{{post_title}}</h1>

I tried with <h1>{{tagline}}</h1> but the output is {{tagline}}

I understood that it shall be possible to address every field in the page hero content. So, if it works like this, I need to know the field name of the tagline.

If possible, it would be good to insert also the Site Title, on desktop only.

Hi there,

there are no template tags for the Site Title or Site Description.
You could create a shortcode with a PHP snippet like this:

add_shortcode( 'tagline', function() {
    ob_start();
    printf( esc_html__( '%s', 'generatepress' ), get_bloginfo ( 'description' ) );
    return ob_get_clean();
} );

then you can add [tagline] to your header element.

If that works then you can create another for the Site Title:

add_shortcode( 'site-title', function() {
    ob_start();
    printf( esc_html__( '%s', 'generatepress' ), get_bloginfo ( 'name' ) );
    return ob_get_clean();
} );

And this shortcode [site-title]

Perfect, thank you.

You're welcome

This archived topic is closed to new replies.