• Currently when I move the mouse cursor over the tab the titles shown are the following:

    For the starting page it’s Example.org

    For subpages it’s [Page Title] – Example.org

    Example.org is what I set as “title of the website” in the common settings, first input line.

    So what I want is, when hovering the mouse over the tab is:

    For the starting page: $myPreText – Example.org[standard text] – $myPostText

    For subpages: $myPreText – Example.org – [subpage title, like for example The latest News, or Impressum] – $myPostText

    How to do that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This can be customised using most of the SEO plugins. Have a look at them: https://de.wordpress.org/plugins/tags/seo/

    Moderator bcworkz

    (@bcworkz)

    If you don’t want to use a SEO plugin, you can probably use the “pre_get_document_title” filter.

    Older themes might need the “wp_title” filter instead.

    Thread Starter cc2024

    (@cc2024)

    Thank you both.

    I will try the“pre_get_document_title” filter, though I’m not sure if this will really achieve what I want. But it’s a good starting point.

    (I don’t want to do it with a pluging, but more directly. Still I also want to stay in the wordpress systematic of calls, filters, hooks and so on. )

    I will later post another question, specifically about the wordpess core’s variables’ documentation, defintions, declaration and dependencies: These details seem to me to be missing in the documentation, not only for the title variable, but in general. (Also in this here question the words “title” and “head” are missing in the title, because the forum software can’t handle a plain < and > in the title.)

    Which variables are involved in the title-tag creation, where are they declared first, what rules have to or should plugins follow to not destroy the schematic flow of wordpress (the schematic on which other plugins may rely)?

    Moderator bcworkz

    (@bcworkz)

    “Title” can be a little ambiguous. There’s the <title> tag, which appears in browser tabs. There’s the actual document title, usually as an <h1> tag. There are tag title attributes. They are all theme dependent, so the correct filter to alter any of them depends on your theme. The <title> tag content for most newer themes is altered through the “pre_get_document_title” filter, but YMMV.

    Assuming “pre_get_document_title” filter applies to your theme, you can learn what values are used for title tag creation for different situations by examining the source code for wp_get_document_title(). In the source code you’ll see other filters you could use to more fine grained control over title tag content. “pre_get_document_title” filter is more of a brute force override filter.

    If you have further questions, try to determine if it relates specifically to your theme or if it’s truly a WP core related question. WP core questions are best asked in these forums, but theme specific questions are best asked in the theme’s dedicated support channel.

    The forum format is not conducive to overly broad questions, you’ll likely just be referred to Developer Resources. It’s usually better to ask more specific, directed questions, even if you need to post multiple, different topics. However, do not cross post the same question into multiple sub-forums. Pick the single best sub-forum for your question.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change tag in to $myPreText – [original page title without base n’ is closed to new replies.