Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #594182

    Hi,
    About a year ago, I posted a thread on a problem with the navigation buttons on a widescreen slider (https://kriesi.at/support/topic/portfolio-navigation-3/). This issue was solved by adding some code. As later on, we installed wpml to add an english version of the website, I noticed another problem. In the code this was used to get the previous and next portfolio-item:

    $temp_prev = $entries[‘prev’];
    $temp_next = $entries[‘next’];

    In the Dutch version, the $temp_next is always empty for every item and in the English version, the $temp_prev is always empty for every item.
    The code I’m using at the moment is:

    add_filter(‘avia_post_nav_entries’, ‘avia_apply_custom_sort_order_to_post_nav’, 10, 2);
    function avia_apply_custom_sort_order_to_post_nav($entries, $settings) {
    $temp_prev = $entries[‘prev’];
    $temp_next = $entries[‘next’];
    $entries[‘prev’] = $entries[‘next’] = “”;

    if(!empty($temp_prev)) $entries[‘next’] = $temp_prev;
    if(!empty($temp_next)) $entries[‘prev’] = $temp_next;

    $res[] = ICL_LANGUAGE_CODE;
    $nummer=id of dutch version of first portfolio-item;

    if($res[0]==’en’){
    $nummer=id of english version of first portfolio-item;
    }

    $first = get_post($nummer, OBJECT);

    if(empty($temp_prev)) $entries[‘next’] = $first;
    return $entries;
    }

    #595370

    Hey mediabelgium!

    Thank you for using Enfold.

    $nummer=id of dutch version of first portfolio-item;

    What is the value or id of that variable? Could you please provide the current code on pastebin.com?

    Regards,
    Ismael

    #595703

    Hi,

    You can find the code on http://pastebin.com/yS4CvEwA

    #598214

    Hey!

    https://kriesi.at/support/topic/portfolio-navigation-3/

    Please try this in the functions.php file:

    add_filter('avia_post_nav_entries', 'avia_apply_custom_sort_order_to_post_nav', 10, 2);
    function avia_apply_custom_sort_order_to_post_nav($entries, $settings) {
        $temp_prev = $entries['prev'];
        $temp_next = $entries['next'];
    
        $entries['prev'] = $entries['next'] = "";
    
        if(!empty($temp_prev)) $entries['next'] = $temp_prev;
        if(!empty($temp_next)) $entries['prev'] = $temp_next;
    
        $res = array();
        $res[] = ICL_LANGUAGE_CODE;
    
        $nummer = 4457;
    
        if($res[0] == 'en'){
            $nummer = 4489;
        }
    
        $first = get_post($nummer, OBJECT);
    
        if(empty($temp_prev)) $entries['next'] = $first;
        return $entries;
    }

    Best regards,
    Ismael

    #599036

    Hi,

    I adjusted the code, but the result remains the same.
    Is you can see on http://en.mediabelgium.be/projects/, after clicking on a project, the next arrow always points to the first project. The previous button has the correct link.
    When you change the language to dutch, the next button has the correct link, but the previous button disappeared (because it has no link).

    Kind regards,
    Media Belgium

    #599409

    Hi!

    Please post the WP and FTP details here so that we can debug the issue carefully.

    Best regards,
    Ismael

    #600302

    Hi,
    You can find the credentials in PC.

    #603561

    Hi!

    We are very sorry for the delay. We deactivated the filter for the post navigation and the post navigation is still not working. I then noticed that you have a very old version of the theme, 3.1.3. Please update the theme to the latest version, 3.5 then we’ll check the issue again. We are very sorry for any inconvenience this issue may have caused you.

    Cheers!
    Ismael

    #604618

    Hi,

    I updated the theme to the latest version. Still no improvement.

    Best regards,

    Media Belgium

    #605654

    Hi!

    I’ve set up a new website containing some projects in a portfolio. The next/previous portfolio-item buttons are working fine, except for the last portfolio-item. The next button links to the previous one. Is there a way to link the very first portfolio item instead?

    Let’s go back to the original issue. You want to set the next button link to go to the first portfolio item when its empty. We suggested a code which is working but then stopped working after a while. It stopped working because you installed the Post Types Order plugin. This plugin somehow breaks the theme’s post navigation so you can’t use it. We modified the code a bit and it’s working as expected but you need to adjust the $nummer value.

    add_filter('avia_post_nav_entries', 'avia_apply_custom_sort_order_to_post_nav', 10, 2);
    function avia_apply_custom_sort_order_to_post_nav($entries, $settings) {
        $res = ICL_LANGUAGE_CODE;
        $nummer = 4457;
        if($res == 'en')  $nummer = 4489;
    
        $first = get_post($nummer, OBJECT);
        if(empty($entries['next'])) $entries['next'] = $first;
        return $entries;
    }
    

    Best regards,
    Ismael

    #605849

    Thanks! I changed a little bit of code, as the sort order of those items is important, but everything works fine at the moment!

    Best regards,

    Media Belgium

    #606461

    Hey!

    Great! Let us know if you need anything else. :)

    Regards,
    Ismael

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Portfolio navigation with WPML’ is closed to new replies.