• Resolved Jurjen

    (@jurjen)


    Hello big brain,

    I’m almost done building my website. However, while some friends were beta-testing, a small bug arose. But I’m not browsing the web for over two days to find a solution.

    I’m using the theme Corpo, which -like several other themes- uses a portfolio plugin.

    When browsing the portfolio pages (custom pages) the tree navigation buttons don’t work: <–Previous [Back to portfolio] Next–>

    For the previous and next, I’ve found this fix (just add in mqtranslate_hooks.php):

    /***************************************************************
    * Function qtranslate_next_previous_fix
    * Ensure that the URL for next_posts_link & previous_posts_link work with qTranslate
    ***************************************************************/
    
    add_filter('get_pagenum_link', 'qtranslate_next_previous_fix');
    
    function qtranslate_next_previous_fix($url) {
        return qtrans_convertURL($url);
    }
    
    /***************************************************************
    * Function qtranslate_single_next_previous_fix
    * Ensure that the URL for next_post_link & previous_post_link work with qTranslate
    ***************************************************************/
    
    add_filter('next_post_link', 'qtranslate_single_next_previous_fix');
    add_filter('previous_post_link', 'qtranslate_single_next_previous_fix');
    
    function qtranslate_single_next_previous_fix($url) {
        $just_url = preg_match("/href=\"([^\"]*)\"/", $url, $matches);
        return str_replace($matches[1], qtrans_convertURL($matches[1]), $url);
    }

    But the back-up-to-portfolio link stays the same. Also, the portfolio link in the main (header) menu is not translated.

    I say translated, but what I really mean is that the language slug ( /fr/ or /nl/) is not included, so it automatically switches to the default language -English in my case- that doesn’t uses a language slug.

    This is how the nagivation buttons (previous, up, next) look like in the template:

    <div class="project-nav">
                    <?php echo previous_post_link('%link', __('&larr; Previous','corpo') ); ?>&nbsp;
                    <a href="<?php echo get_post_type_archive_link('corpo_portfolio'); ?>" title="<?php _e('All projects','corpo'); ?>"><i class="icon-th-large"></i></a>&nbsp;
                    <?php echo next_post_link('%link', __('Next &rarr;', 'corpo') ); ?>
                </div>

    I assume also that when the corpo_portfolio link is repaired in the navigation, it will also fix it in the main menu.

    Any ideas?

    Thanks!!

    https://www.ads-software.com/plugins/mqtranslate/

Viewing 1 replies (of 1 total)
  • Thread Starter Jurjen

    (@jurjen)

    Fixed by adding these two lines as well to mqtranslate_hooks.php (look for // Hooks (execution time non-critical filters)):

    add_filter('post_type_link',				'qtrans_convertURL');//fix custom post type URL
    add_filter('post_type_archive_link',		'qtrans_convertURL');//fix custom post type archive URL
Viewing 1 replies (of 1 total)
  • The topic ‘Portfolio links untranslated’ is closed to new replies.