Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22312

    Hey Nick,

    I finally switched my site back to how it was before Xmas, with WPML running on a wing and a prayer without the config files from Shoutbox. It works, I can change the backend settings and the featured images retain the mouseover activity, which is what I need. So I’m leaving it like that.

    However doing it this way means that there are some settings controlled by the theme which cant be set in two languages. So I need to find a way to hardcode them into the theme itself. The most important at the moment is the site logo, because it is a .png file image with text in different languages.

    I need to add some code inside one of the .php files (maybe the header?) to check which language the site is showing (from the WPML switcher) and then display the appropriate logo.

    Checking with firebug, the logo image seems to be set inside the header container.

    Thanks!

    rich

    #115376

    Hi,

    Add following code to functions.php (insert it at the very bottom):

    function avia_logo($use_image = "", $sub = "", $headline_type = "h3")
    {
    $headline_type = apply_filters('avia_logo_headline_filter', $headline_type);

    if(ICL_LANGUAGE_CODE == 'en')
    {
    $logo = avia_get_option('logo');
    }
    else if(ICL_LANGUAGE_CODE == 'de')
    {
    $logo = 'http://mywebsite.com/mysecondlogo.jpg';
    }

    $logo = "<img src=".$logo." alt='' />";
    $logo = "<$headline_type class='logo'><a href='".home_url('/')."'>".$logo."$sub</a></$headline_type>";

    return $logo;
    }

    Instead of ‘en’ insert the language shortcut of your primary language and replace ‘de’ with the shortcut of your second language. Then replace http://mywebsite.com/mysecondlogo.jpg with a valid url to an image/logo.

    #115377

    Hey Dude!

    Thanks for that code.

    One thing I didn’t understand… where does the first logo come from? From the url inserted into the Theme Options settings?

    rich

    #115378

    I get an error Dude:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /xxx/html/wp-content/themes/shoutbox/functions.php on line 216

    rich

    #115379

    Sorry! I missed a back tick in the logo url – damn those things are hard to spot!

    Now it’s fine!

    Thanks Dude!

    #115380

    Hi!

    Glad it works now :)

    Best regards,

    Peter

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

The topic ‘Hardcoding site logo – WPML workaround’ is closed to new replies.