-
AuthorPosts
-
June 15, 2015 at 6:05 pm #459561
Hi Guys
I wasn’t sure of if the answer in the forum was definate.
I’m using a portfolio grid to show related portfolio entries from the same category on my portfolio pages. Is there a way to remove the current portfolio entry from that related list? e.g. to show all the XX category entries excluding the portfolio page you are on?
Thanks
June 16, 2015 at 12:00 pm #459984Hey getfletch!
Thank you for using Enfold.
Add this in the functions.php file to prevent duplicate posts:
/*filter portfolio sorting */ add_filter('avia_post_grid_query', 'avf_custom_post_grid_query'); function avf_custom_post_grid_query ( $query ) { if(is_singular('portfolio')) { $query['offset'] = 1; } return $query; }
Best regards,
IsmaelJune 17, 2015 at 3:01 pm #460819Hi Ismael
Can you confirm where exactly I should paste the code as I keep getting this error
Warning: require_once(config-wpml/config.php) [function.require-once]: failed to open stream: No such file or directory in /home/getfletc/public_html/grandmawilds/wp-includes/functions.php on line 57
Fatal error: require_once() [function.require]: Failed opening required ‘config-wpml/config.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/getfletc/public_html/grandmawilds/wp-includes/functions.php on line 57
Thanks
June 18, 2015 at 12:49 pm #461234Hey!
You can add it at the very bottom of the functions.php file. Please don’t copy the code straight from your email. Get it from the forum.
Cheers!
IsmaelJune 19, 2015 at 9:53 am #461759Hi
It is a bit hit and miss, it works on some but not many http://grandmawilds.getfletch.co.uk/
If you need a login and ftp access let me know
June 19, 2015 at 4:19 pm #462031Hey!
Please try to replace the code with this:
/*filter portfolio sorting */ add_filter('avia_post_grid_query', 'avf_custom_post_grid_query'); function avf_custom_post_grid_query ( $query ) { $query['offset'] = 1; return $query; }
Regards,
IsmaelJune 19, 2015 at 4:23 pm #462034Hi!
If the above code doesn’t work for all portfolio items, try this:
function ava_exclude_portfolio($query) { if (is_singular('portfolio')) { $query->set( 'offset', '1' ); } } add_action('pre_get_posts', 'ava_exclude_portfolio');
Best regards,
IsmaelJune 23, 2015 at 2:43 pm #463425Hi Ismael
Any other suggestions as none of the above works?
Thanks
June 25, 2015 at 9:00 am #464448Hi!
Works fine on our installation. Please post the login details here so that we can check it.
Cheers!
IsmaelJune 30, 2015 at 8:43 am #466214hi did you get the login details?
June 30, 2015 at 11:07 am #466300Hi!
Where did you add the code? I checked the functions.php file but it’s not there. And you’re using an old version of the theme, 3.0.4. Please update to the latest version, 3.1.2.
Cheers!
IsmaelJune 30, 2015 at 2:07 pm #466422I’ve updated to the latest version of enfold, Updated the functions.php file by adding the codes supplied above (tried all 3). The first one works on some but not all the other 2 I can’t get to work
July 1, 2015 at 12:16 pm #466914Hi!
Alright. We modified the code a bit and it’s working now.
http://grandmawilds.getfletch.co.uk/Products/stem-ginger-biscuit-window-box/
http://grandmawilds.getfletch.co.uk/Products/yorkshire-parkin-window-box/
http://grandmawilds.getfletch.co.uk/Products/cherry-bakewell-biscuit-window-box/Cheers!
IsmaelAugust 20, 2015 at 4:24 pm #490882Ismael
Sorry to jump in here, what code did you use in the end to fix this as I’m after the same modification.
Thanks
RichardAugust 24, 2015 at 1:39 am #491961Hey!
Did you try the code above?
function ava_exclude_portfolio($query) { $query->set( 'offset', '1' ); } add_action('pre_get_posts', 'ava_exclude_portfolio');
Cheers!
IsmaelAugust 24, 2015 at 10:17 am #492064Excellent, thank you Ismael.
Richard
-
AuthorPosts
- The topic ‘Remove Current Portfolio Post from related portfolio grid Enfold’ is closed to new replies.