Tagged: ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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,
    Monique

    #523360

    Hi Monique!

    Have you tried using the Offset option (exclude current Post) in the grid popup settings)?

    Cheers!
    Josue

    #523556

    Hi 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,
    Monique

    #524547

    Hey 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,
    Josue

    #524764

    Thanks 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,
    Monique

    #524768

    Hi!

    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,
    Josue

    #524781

    Hi Josue,

    Ok, I understand.
    Please see account details in private content.

    Regards,
    Monique

    #525245

    Hey Monique!

    Check it now.

    Best regards,
    Josue

    #525372

    Hey 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,
    Monique

    #525390

    Hey!

    It was WP Super Cache, i just turned it off so the code in child functions.php could be reflected.

    Cheers!
    Josue

    #526020

    Hi 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,
    Monique

    #526379

    Correct, 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,
    Josue

    #527294

    Thank you Josue!

    You can flag this topic as closed.

    Have nice weekend,
    Monique

    #527315

    You are welcome Monique, glad to help :)

    Regards,
    Josue

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘On single portfolio exclude current portfolio from 'show more projects'’ is closed to new replies.