Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #16955

    I have the same problem that was discussed here using qtranslate with coherence.

    http://www.kriesi.at/support/topic/qtranslate-home-link-resets-selected-language-how-to-modify-code

    see towards the bottom of that post,

    Dude posted – “The logo code can be found in abundanceframeworkphpfunction-set-avia-frontend.php:”

    <br />
    function avia_logo()<br />
    {<br />
    if($logo = avia_get_option('logo'))<br />
    {<br />
    $logo = "<img src=".$logo." alt='' />";<br />
    $logo = "<h1 class='logo'><a>".$logo."</a></h1>";<br />
    }<br />
    else<br />
    {<br />
    $logo = get_bloginfo('name');<br />
    $logo = "<h1 class='logo bg-logo'><a>".$logo."</a></h1>";<br />
    }</p>
    <p> return $logo;<br />
    }</p>
    <p>

    I found the code in that location and modified it as Chris suggested,

    Replacing-

    <a href='".home_url('/')."'>

    with

    <a href='".bloginfo('url')."'>

    the result was for it to work but above the logo it now shows a the text of the link at the same time displaying what the home image links to?

    is there a way to stop it from showing this?

    Then i tried the next solution on replacing the code with.

    </p>
    <p>function avia_logo()<br />
    {<br />
    $lang = isset($_GET['lang']) ? '?lang='.esc_attr($_GET['lang']) : '';</p>
    <p> if($logo = avia_get_option('logo'))<br />
    {<br />
    $logo = "<img src=".$logo." alt='' />";<br />
    $logo = "<h1 class='logo bg-logo'><a href='".home_url($lang)."'>".$logo."</a></h1>";<br />
    }<br />
    else<br />
    {<br />
    $logo = get_bloginfo('name');<br />
    $logo = "<h1 class='logo bg-logo'><a href='".home_url($lang)."'>".$logo."</a></h1>";<br />
    }</p>
    <p> return $logo;<br />
    }<br />
    }</p>
    <p>

    Changing to this code didn’t work but it also didn’t cause any errors.

    Is there something I am missing, is there something different in the avia framework on the coherence theme compared to the abundance theme?

    Why does it show a text version of the link as well as the logo image?

    is there some quick fix for this I am not spotting?

    Unfortunately the site is currently live, so I have reverted back to the original code for now but my client really wants this fixed.

    Any help is really appreciated. Thanks!

    #93543

    Hi!

    Yes – instead of:

    <a href='".bloginfo('url')."'>

    use following code:

    <a href='".get_bloginfo('url')."'>

    Regards,

    Peter

    #93544

    Thanks Peter, I have tried changing the code so it looks like this:

    function avia_logo($use_image = "")
    {
    $use_image = apply_filters('avia_logo_filter', $use_image);

    if($logo = avia_get_option('logo'))
    {
    $logo = "<img src=".$logo." alt='' />";
    $logo = "<h1 class='logo'><a href='".get_bloginfo('url')."'>".$logo."</a></h1>";
    }
    else
    {
    $logo = get_bloginfo('name');
    if($use_image) $logo = "<img src=".$use_image." alt='' title='$logo'/>";
    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url')."'>".$logo."</a></h1>";
    }

    return $logo;
    }
    }

    the link still goes back default, then I tried this:

    function avia_logo($use_image = "")
    {
    $lang = isset($_GET['lang']) ? '?lang='.esc_attr($_GET['lang']) : '';

    if($logo = avia_get_option('logo'))
    {
    $logo = "<img src=".$logo." alt='' />";
    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url')."'>".$logo."</a></h1>";
    }
    else
    {
    $logo = get_bloginfo('name');
    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url')."'>".$logo."</a></h1>";
    }

    return $logo;
    }
    }

    in both cases the logo looked correct but when having a different language selected it still resets back to the original. can you spot anything I have done wrong?

    Thanks

    Graham

    #93545

    No, the code seems to be correct. I’d check the link tarket of the logo though. If get_bloginfo(‘url’) returns the same url on both websites it’s probably a plugin issue (bug) and I’d contact the plugin author. You can also try to add the $lang variable to the url like:

    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url').$lang."'>".$logo."</a></h1>";

    but I’m not familiar with the plugin and it’s just a “blind guess”.

    #93546

    Ok thanks Peter,

    For the benefit of others with a similar problem this is where I have got to-

    From what I can tell the issue now lies with permalinks.

    In qtranslate settings>advanced you have these options-

    Use Query Mode (?lang=en)

    Use Pre-Path Mode (Default, puts /en/ in front of URL)

    Use Pre-Domain Mode (uses http ://en.yoursite .com)

    if I set it to Use Query Mode then the home link now works, which is ok, once I switch it back to Use Pre-Path Mode I can’t get it to work.

    I tried resetting the standard wordpress permalinks from settings>permalinks but I still have not got it working using Pre-Path Mode.

    This is the code I am now using:

    function avia_logo($use_image = "")
    {
    $lang = isset($_GET['lang']) ? '?lang='.esc_attr($_GET['lang']) : '';

    if($logo = avia_get_option('logo'))
    {
    $logo = "<img src=".$logo." alt='' />";
    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url').$lang."'>".$logo."</a></h1>";
    }
    else
    {
    $logo = get_bloginfo('name');
    $logo = "<h1 class='logo bg-logo'><a href='".get_bloginfo('url').$lang."'>".$logo."</a></h1>";
    }

    return $logo;
    }
    }

    I will see if I can find a solution from the qtranslate forum, if I find a solution I will post it here.

    If anyone has any further advice or suggestions they can add to this it would be much appreciated! I am pulling my hair out here..

    Thanks

    #93547

    Hey!

    I hope the qtranslate author can help you…

    Regards,

    Peter

    #93548

    I have looked around for a week now and still haven’t found anything I can get to work.

    I found an interesting resource for qtranslate – http://shailan.com/3283/displaying-content-based-on-current-language-using-qtranslate/

    They suggest this method for converting URLs in the header.php file, -

    <a href="<?php qtrans_convertURL( bloginfo('url') ); ?>">My Awesome Blog Homepage</a>

    I thought it could be applied like this $logo = "<h1 class='logo bg-logo'><a href='"qtrans_convertURL( bloginfo('url') );"'>".$logo."</a></h1>";

    but my php knowledge is rubbish so i’m just guessing the syntax! Can you spot an error in this?

    Thanks!

    #93549

    Hi!

    You can try following code instead – the syntax is right however I don’t know it it works…

    $logo = "<h1 class='logo bg-logo'><a href='". qtrans_convertURL( bloginfo('url') ) . "'>".$logo."</a></h1>";

    Best regards,

    Peter

    #93550

    Ok I finally have it solved and have Tested it in both Eunoia and Coherence themes :)

    So for the benafit of others here is how to do it, The file is located here -

    /wp-content/themes/eunoia/framework/php/function-set-avia-frontend.php

    or here for coherence obviously -

    /wp-content/themes/coherence/framework/php/function-set-avia-frontend.php

    Replace-

    <a href='".home_url('/')."'>

    with this -

    <a href='".qtrans_convertURL (get_bloginfo('url'))."'>

    So the code for that section once modified should look like this -

    function avia_logo()
    {
    if($logo = avia_get_option('logo'))
    {
    $logo = "<img src=".$logo." alt='' />";
    $logo = "<h1 class='logo'><a href='".qtrans_convertURL (get_bloginfo('url'))."'>".$logo."</a></h1>";
    }
    else
    {
    $logo = get_bloginfo('name');
    $logo = "<h1 class='logo bg-logo'><a href='".qtrans_convertURL (get_bloginfo('url'))."</a></h1>";
    }

    return $logo;
    }
    }

    I hope this saves someone some time.

    Thanks for your help Peter couldn’t have done it without you.

    #93551

    Hey!

    Glad that I could help you :)

    Regards,

    Peter

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘qtranslate – home image link resets selected language back to default.’ is closed to new replies.