Logo neben Titel

  • Liebe Leute,

    mir ist klar, dass dieses Thema schon etliche Male hier im Forum aufgetaucht ist aber nachdem ich nun alles ausprobiert habe und nichts davon funktioniert hat...


    Ich nutze das Theme "verysimplestart" und würde da nun gerne das Logo neben dem Titel haben. Das Logo lässt jedoch nur eines vom beiden zu.
    Hier einmal die Stelle um die es glaube ich geht:

    PHP
    <?php if ( get_theme_mod('site_logo') ) : ?>                    
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo('name'); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" /></a>               
     <?php else : ?>

    kann mir jemand helfen?

    Gruß,
    Benny

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • kann dir nicht wirklich helfen, aber vlcht wäre es ein Versuch, die if-Anweisung zu entfernen - schon mal probiert?

    [COLOR=#0000BB][FONT=monospace]<?php [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_theme_mod[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'site_logo'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) : [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR][COLOR=#000000][FONT=monospace] [/FONT][/COLOR]
    [COLOR=#000000][FONT=monospace]<a href="[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]<?php [/FONT][/COLOR][COLOR=#007700][FONT=monospace]echo [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]esc_url[/FONT][/COLOR][COLOR=#007700][FONT=monospace]( [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]home_url[/FONT][/COLOR][COLOR=#007700][FONT=monospace]( [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'/' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]) ); [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR][COLOR=#000000][FONT=monospace]" title="[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]<?php bloginfo[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'name'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]); [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR][COLOR=#000000][FONT=monospace]"><img class="site-logo" src="[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]<?php [/FONT][/COLOR][COLOR=#007700][FONT=monospace]echo [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]esc_url[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_theme_mod[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'site_logo'[/FONT][/COLOR][COLOR=#007700][FONT=monospace])); [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR][COLOR=#000000][FONT=monospace]" alt="[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]<?php bloginfo[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'name'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]); [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR][COLOR=#000000][FONT=monospace]" /></a> [/FONT][/COLOR]

  • Ok ich habe den Fehler glaube ich entdeckt.
    Jetzt wo ich festgestellt habe, dass ein if auch ein else hat :roll: brauche ich das ja eigentlich nur umstellen oder?

    Einmal editiert, zuletzt von walli3 (26. März 2017 um 22:01)

  • […] brauche ich das ja eigentlich nur umstellen oder?

    Nein.

    (Zumindest wenn ich deine Frage richtig verstanden habe. Das war / ist eher das Problem, dass du so schreibst, dass man zuerst mal fragen muss, ob man dich überhaupt richtig versteht … )

    Dein bisheriger Code heißt: Wenn in deinen Theme-Einstellungen ein Logo definiert ist, dann zeige dieses und verlinke es zur Startseite (if),
    wenn nicht (else) dann gib den Blogtitel (verlinkt zur Startseite) und den Untertitel aus.

    Du musst also zu deinem if noch ergänzende den Blogtitel dazuschreiben, ggf. auch den Untertitel.

    Dietmar78: die if-Abfrage ist schon richtig. Ohne if-Abfrage ist immer fehleranfällig, wenn in den Einstellungen dann kein Logo definiert ist.

    Gruß
    helix

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!