-
AuthorPosts
-
December 4, 2013 at 7:32 pm #196331
Hello,
I hoping for some guidance on using the “portfolio grid” function as a “related projects” element. Works beautifully except it includes the item that the page is about. For example, on the page link below, The Natai is the project but is also referenced as related. Any thoughts on how to remove portfolio items from showing up without removing the category. I’ve set up custom fields on the register-portfolio.php page in hopes there is something that could be done though that. Thanks so much for any assistance you can provide.
http://paulraffstudio.wpengine.com/portfolio-item/the-natai/ (hosted on WPengine)
December 6, 2013 at 10:14 pm #197125Hi shelteredinsound!
Open /config-templatebuilder/avia-shortcodes/portfolio.php and look for line 659:
$query = array( 'paged'=> $page, 'posts_per_page' => $params['items'], 'post_type' => $params['post_type']);
Replace it by this:
$query = array( 'paged'=> $page, 'posts_per_page' => $params['items'], 'post_type' => $params['post_type'], 'post__not_in' => array(get_the_ID()));
Cheers!
JosueDecember 11, 2013 at 11:20 pm #199252Can you double check on that line of code? I can’t get the code to correctly remove the post. Thanks very much.
December 12, 2013 at 1:15 am #199279Hi,
I performed a test locally before posting it, can you create an administrator account and post it here as a private reply?
Regards,
JosueDecember 12, 2013 at 2:43 am #199325This reply has been marked as private.December 12, 2013 at 3:00 am #199329The access is not working :/
Best regards,
JosueDecember 12, 2013 at 3:51 am #199338This reply has been marked as private.December 12, 2013 at 4:00 am #199339This reply has been marked as private.December 12, 2013 at 9:48 am #199400Hi!
You can do what Josue instructed. Edit config-templatebuilder > avia-shortcodes > portfolio.php, find this code on line 658:
$query = array( 'paged'=> $page, 'posts_per_page' => $params['items'], 'post_type' => $params['post_type']);
Add the post__not_in parameter plus the posts id that you want to remove on the portfolio grid. As example, remove the “Cascade House” and the “The Natai” entry using this:
$query = array( 'paged'=> $page, 'posts_per_page' => $params['items'], 'post_type' => $params['post_type'], 'post__not_in' => array( 17,62 ));
If you can’t find it, you can add this on functions.php:
function custom_post_grid_query( $query, $params ) { $query['post__not_in'] = array( 17,62 ); return $query; } add_filter( 'avia_post_grid_query', 'custom_post_grid_query', 10, 2);
Cheers!
IsmaelMay 21, 2014 at 11:22 pm #268313Hello
I am trying to do the same thing, ie, just remove the portfolio item on which the single page is displaying. I tried to modify the portfolio.php file using the code at the top of this post and it didn’t remove the item on the single page – could you please provide the code to go into the functions.php file instead, just like above here but without a reference to removing specific items (if I knew some php I could probably do it but want to make sure it’s correct). Thank you in advance.May 21, 2014 at 11:36 pm #268324May 21, 2014 at 11:38 pm #268326This reply has been marked as private. -
AuthorPosts
- The topic ‘Removing specific portfolio items from portfolio grid’ is closed to new replies.