-
AuthorPosts
-
March 7, 2016 at 10:48 am #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;
}March 9, 2016 at 8:38 am #595370Hey 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,
IsmaelMarch 9, 2016 at 5:38 pm #595703Hi,
You can find the code on http://pastebin.com/yS4CvEwA
March 15, 2016 at 7:46 am #598214Hey!
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,
IsmaelMarch 16, 2016 at 5:35 pm #599036Hi,
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 BelgiumMarch 17, 2016 at 4:42 am #599409Hi!
Please post the WP and FTP details here so that we can debug the issue carefully.
Best regards,
IsmaelMarch 18, 2016 at 2:44 pm #600302Hi,
You can find the credentials in PC.March 25, 2016 at 6:23 am #603561Hi!
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!
IsmaelMarch 29, 2016 at 3:18 pm #604618Hi,
I updated the theme to the latest version. Still no improvement.
Best regards,
Media Belgium
March 31, 2016 at 6:57 am #605654Hi!
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,
IsmaelMarch 31, 2016 at 1:04 pm #605849Thanks! 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
April 1, 2016 at 4:40 am #606461 -
AuthorPosts
- The topic ‘Portfolio navigation with WPML’ is closed to new replies.