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

    #459984

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

    #460819

    Hi 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

    #461234

    Hey!

    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!
    Ismael

    #461759

    Hi

    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

    #462031

    Hey!

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

    #462034

    Hi!

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

    #463425

    Hi Ismael

    Any other suggestions as none of the above works?

    Thanks

    #464448

    Hi!

    Works fine on our installation. Please post the login details here so that we can check it.

    Cheers!
    Ismael

    #466214

    hi did you get the login details?

    #466300

    Hi!

    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!
    Ismael

    #466422

    I’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

    #466914
    #490882

    Ismael

    Sorry to jump in here, what code did you use in the end to fix this as I’m after the same modification.

    Thanks
    Richard

    #491961

    Hey!

    Did you try the code above?

    function ava_exclude_portfolio($query) {
         $query->set( 'offset', '1' );
    }
    
    add_action('pre_get_posts', 'ava_exclude_portfolio');

    Cheers!
    Ismael

    #492064

    Excellent, thank you Ismael.

    Richard

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Remove Current Portfolio Post from related portfolio grid Enfold’ is closed to new replies.