WordPress, WPML and Widget Title Link plugin

If you need to have your widget titles a links but you have multi language website with WPML plugin you can use a plugin “Widget Title Links” by Ragulka and my small code snippet, please add this to your theme’s functions.php:

add_filter('widget_title_link', 'wpml_widget_title_link');

function wpml_widget_title_link($title_link)
{
    // this removes http:// because it is added by esc_url in widget-title-link.php:L88
    $title_link = preg_replace('/https?:\/\//', '', $title_link);

    // this WPML helper generates link to translated post/page/category/etc WP object
    $link = icl_link_to_element(
        $title_link,
        $element_type = 'post',
        $link_text = '',
        $optional_parameters = array(),
        $anchor = '',
        $echoit = false,
        $return_original_if_missing = true
    );

    // this cuts URL from a generated link
    if (preg_match('/href="([^"]+)"/', $link, $matches)) {
        return $matches[1];
    } else {
        return false;
    }
}

After that you can specify WP Object ID in the widget “Title link” field and WPML will find translated object and create URL for widget title:

Screenshot 2014-07-16 13.16.12

How to download iOS8 for iPhone or iPad

Very short post about how to get IOS8 to your device.

WARNING: IOS8 is very raw and you think twice before upgrade! There is no rollback and if you decide to update no matter of what – BACKUP YOUR PHONE!

OK, IOS8 is available now only for developer so you should have Apple Developers Program subscription to get is. But if you don’t have – also not a problem, find someone who has it and ask to add your device UDID to his provisioning profile. Continue reading “How to download iOS8 for iPhone or iPad”

OSX 10.10 Yosemite fix Homebrew

OSX 10.10 Yosemite comes with ruby 2.0 bundled and Homebrew is designed to work with ruby 1.8.x.

I opened file vim /usr/local/Library/brew.rb , changed first line to #!/Users/alex/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -W0 (I didn’t have ruby 1.8 installed within rvm)

After that we need to do brew update, but this will not work because we need to commit our changes:

cd $(brew –repository) && git commit -a -m ‘new ruby version 1.9’

After that you can do brew update  and fight with more interesting issues 🙂

Please read my UPDATES below.

Continue reading “OSX 10.10 Yosemite fix Homebrew”