-
AuthorPosts
-
October 21, 2015 at 5:53 pm #522404
Hi there,
Please see an example of a single portfolio item on our development website at: http://new.arti-sign.nl/project/kijk-haar/.
Just before the footer, under “NOG EEN PAAR PROJECTEN” I have created a full width grid section in which I want to show other portfolio entries.
How can I exclude the current portfolio item from this grid?
Last year I build another website using Enfold and I than got the advise to add the following code to the child’s functions.php:
add_filter( 'avia_post_grid_query', 'avia_portfolio_query', 10, 2); function avia_portfolio_query( $query, $params ) { if(is_single()) { $id = get_the_ID(); if(avia_post_grid::$grid == 0) $query['post__not_in'] = array($id); } return $query; }
However, that doesn’t work here (in this version?).
Please advise.
Thanks & regards,
MoniqueOctober 22, 2015 at 11:35 pm #523360Hi Monique!
Have you tried using the Offset option (exclude current Post) in the grid popup settings)?
Cheers!
JosueOctober 23, 2015 at 9:55 am #523556Hi Josue,
Thanks for your reply.
It would be great if something like that would be available, however I can’t find it…? I use a Dutch version and when I translate correctly, following is what I can configure when using a grid:
- Which items
- Sortable
- Post number
- Columns
- Page numbering
- Sorting on
- Ascending/descending
- Format settings
- Space between elements
- Overlay
- Title and excerpt
- Show title aned excertpt
- For developers: section ID
That is all I can see.
I have checked with the portfolio grid, but also there I cannot find the Offset option.
Btw: I have used the (normal) grid because of the possibility to show title and excerpt only when hovering. This option is not available in Portfolio grid.
Reagrds,
MoniqueOctober 25, 2015 at 11:14 pm #524547Hey Monique!
Try changing your code to the following:
add_filter( 'avia_masonry_entries_query', 'avia_masonry_query_func', 10, 2); function avia_masonry_query_func( $query, $params ) { if(is_single()) { $id = get_the_ID(); $query['post__not_in'] = array($id); } return $query; }
Best regards,
JosueOctober 26, 2015 at 10:27 am #524764Thanks Josue,
Obviously there should have been an Offset option available, which I don’t have. Can you explain that?
Unfortunately your code suggestion doesn’t work… At this example you can see the current portfolio item also in more projects (NOG EEN PAAR PROJECTEN).
Please advise.
Best regards,
MoniqueOctober 26, 2015 at 10:30 am #524768Hi!
No, actually there is no offset option for the masonry element (only for the blog posts element at the moment) so we need to use a code approach, can you please create me a WordPress administrator account? post it here as a private reply.
Regards,
JosueOctober 26, 2015 at 10:51 am #524781Hi Josue,
Ok, I understand.
Please see account details in private content.Regards,
MoniqueOctober 27, 2015 at 12:21 am #525245Hey Monique!
Check it now.
Best regards,
JosueOctober 27, 2015 at 9:55 am #525372Hey Josue,
Seems to work fine now!
Can you tell me what you have done? I can see some extra php files in wp-content. Are these the solution?
If that is the case, I assume I do not have to change all single portfolio items?
Thanks a lot,
regards,
MoniqueOctober 27, 2015 at 10:54 am #525390Hey!
It was WP Super Cache, i just turned it off so the code in child functions.php could be reflected.
Cheers!
JosueOctober 28, 2015 at 11:50 am #526020Hi Josue,
I haven’t work a lot with WP Super cache yet. So, you turned it off and than on again (because it is active now)? Does that mean that WP Super cache can influence changes in code/installation?
So finally the code you gave me October 25, 2015 at 11:14 pm is correct?
Thanks for your help!
Cherio,
MoniqueOctober 28, 2015 at 8:42 pm #526379Correct, this code should work. WP Super Cache prevented the code from being reflected because it was showing a cached version of the Page, to fix that you can either turn off or clear the cache.
Best regards,
JosueOctober 30, 2015 at 11:21 am #527294Thank you Josue!
You can flag this topic as closed.
Have nice weekend,
MoniqueOctober 30, 2015 at 12:36 pm #527315You are welcome Monique, glad to help :)
Regards,
Josue -
AuthorPosts
- The topic ‘On single portfolio exclude current portfolio from 'show more projects'’ is closed to new replies.