
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
March 17, 2025 at 10:14 pm #1479574
Hi,
i added this code to function.php:function add_dynamic_hidden_h1() { if (!is_admin()) { $page_title = get_the_title(); if (empty($page_title)) { $page_title = "Unbekannte Seite"; // Fallback } echo '<div style="position:absolute; left:-9999px; top:-9999px;"> <h1>My Website - ' . esc_html($page_title) . '</h1> </div>'; } } add_action('wp_body_open', 'add_dynamic_hidden_h1');
As my layout has very less text, because of design reasons, i’m trying to add “My Website -” as h1 (almost for seo reasons) and to load the page-title next to it.
In my source code it looks like this:
<div style="position:absolute; left:-9999px; top:-9999px;"> <h1>My Website - Explore</h1> </div> <div id='wrap_all'>
Which is what i’m trying to archive.
Unfortunetly, when i go to Google webmaster tools and do a live test, i get something different:
<div style="position:absolute; left:-9999px; top:-9999px;" aria-hidden="true"> <h1>My Website - Explore</h1> </div> <div id="wrap_all" aria-hidden="true">
Which seems not to works for seo?
How can i fix that?kind regards
JakMarch 22, 2025 at 8:18 pm #1479929Hey Jak73,
I don’t find this element on your page, perhaps a screenshot would help.Best regards,
MikeMarch 24, 2025 at 9:05 am #1480032Got it!
Thank youMarch 25, 2025 at 8:12 am #1480107but you do not want to combine those things mentioned on the other post?
see f.e.: https://enfold.webers-webdesign.de/impressum/
see text logo above , when you switch to other posts/pagesfunction use_text_logo_only($logo){ $link = apply_filters( 'avf_logo_link', home_url( '/' ) ); $logo_tag = "h1"; $logo_heading = "Webers Webdesign"; $alt = get_bloginfo( 'name' ); $title = get_bloginfo( 'name' ); $page_title = get_the_title(); if(is_search()){ $logo = '<a class="logo text-logo" href="'.$link.'" alt="'.$alt.'" title="'.$title.'"><'.$logo_tag.'>' .$logo_heading.' - Suchergebnisse</'.$logo_tag.'></a>'; } elseif(is_front_page()){ $logo = '<a class="logo text-logo" href="'.$link.'" alt="'.$alt.'" title="'.$title.'"><'.$logo_tag.'>' .$logo_heading.'</'.$logo_tag.'></a>'; } else{ $logo = '<a class="logo text-logo" href="'.$link.'" alt="'.$alt.'" title="'.$title.'"><'.$logo_tag.'>' .$logo_heading.' - '.$page_title.'</'.$logo_tag.'></a>'; } return $logo; } add_filter('avf_logo_final_output','use_text_logo_only');
#top .logo.text-logo { display: flex; justify-content: left; align-items: center; width: auto; } #top .logo.text-logo h1 { margin: 0 !important; font-size: 30px; }
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.