Hi since one year right now I used The Grid plugin from Themeone and I used the methode previously provided to me here: https://toolset.com/fr/forums/topic/display-view-content-with-the-grid-plugin-part-2/ to display my post into a grid.
But due to the lake of update and the oldest technology used by the plugin I decided to use a fresh new plugin GridbuilderWP hidden link from the same developper Themeone. Its praticaly the same plugin, but more powerfull and much faster than the older.
But I need to use Gridbuilder to display related post like I do before with The Grid Plugin. I used this code to do this :
[php]<?php
/**
* Permet à The Grid d'afficher correctement les articles en relation (Relationship) avec toolset. https://toolset.com/forums/topic/display-view-content-with-the-grid-plugin/ */
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
function my_query_args($query_args, $grid_name) {
if ($grid_name == 'Master Archive Grid') {
global $post;
error_log('$post: ' . print_r($post, true));
$related_posts = toolset_get_related_posts( $post->ID, 'branch-post', array( 'query_by_role' => 'parent', 'limit' => 999, 'return' => 'post_id', 'role_name_to_return' => 'other' ) );
error_log('related_posts: ' . print_r($related_posts, true));
$query_args['post__in'] = $related_posts;
}
return $query_args;
}
add_filter('tg_wp_query_args', 'my_query_args', 10, 2);[php]
I think I can use the same code but tweaked for Gridbuilder to do same thing, here documentation form Gridbuilder hidden link
I dont have technical knowledge so I dont know what to do, maybe changing Grid Name for Grid ID, because Gridbuilder use Grid ID to call there grid instead of Grid name.