No, I’m using function within the theme code. Here’s a sample:
/**
* This function is used to retrieve call-to-action items only.
*/
function setup_related_call_to_action($post_id, $taxonomies, $post_type){
if ( function_exists( 'km_rpbt_get_related_posts' ) ) {
$post_types = array('call-to-action');
$args = array(
'taxonomies' => $taxonomies,
'include_self' => false,
'post_types' => $post_types,
'order' => 'DESC',
'orderby' => 'post_date'
);
global $related_call_to_action_posts;
global $related_call_to_action_posts_counter;
$related_call_to_action_posts = get_field('related_ctas_sidebar', $post_id);
// If no manual relationship found, relate by taxonomy via plugin
if( !is_array( $related_call_to_action_posts ) || count( $related_call_to_action_posts ) == 0 ){
$related_call_to_action_posts = km_rpbt_get_related_posts( $post_id, $args );
}
$related_call_to_action_posts = array_reverse($related_call_to_action_posts);
$related_call_to_action_posts_counter = 0;
}
return;
}
-
This reply was modified 5 years, 6 months ago by keesiemeijer.