Plugin Author
Ajay
(@ajay)
What is the code you’re using for the Ajax call?
Since 3.1, the plugin also supports the REST API, so I’m not sure if that would be easier to fetch the posts via Ajax and create the HTML on the fly?
https://webberzone.com/support/knowledgebase/wp-rest-api-integration/
Hi Ajay,
thanks for your quick response.
well I use
if ( function_exists( ‘echo_crp’ ) ) { echo_crp(); }
as line code to fetch the information from the crp plugin.
I want to use ajax and I am aware that not in the loop so parameters (at least page_id) are needed to work fine.
I’ll take a look at the rest api and will make response afters tests.
regards;
Hi,
I’ve just seen
get_crp_posts() on your website webberzone.com
would it be not more convinient to use it ?
regards,
Plugin Author
Ajay
(@ajay)
Hi Ajay, it’s ok now.
I’ve used get_crp_posts() in my php code thru an ajax mechanism.
it works fine on my resume-cv blog. I use it to delay the display of some bottom information.
many thanks for your advices and all the work on your plugins.
kind regards.
Plugin Author
Ajay
(@ajay)
@barbaroux
Will you be able to share the code you’re using – I’m quite curious on the implementation and if there is a performance improvement
on server side, this is the main function used :
function appel_crp($po) {
$li=6;
$thumb_height=140;
$thumb_width=140;
$thumb_meta="post-image";
$thumb_html="html";
$thumb_default="";
$thumb_default_show=true;
$thumb_timthumb="";
$thumb_timthumb_q="";
$scan_images=false;
if ( function_exists( 'get_crp_posts' ) )
{
$results = get_crp_posts(array ('postid' => $po, 'limit' => $li));
if ($results) {
$output='<div class="crp_related crp_related_widget crp-grid"><ul>';
foreach ($results as $result)
{
$output.="<li>";
$output .= '<a href="' . get_permalink($result->ID) . '" ' . $rel_attribute . ' ' . $target_attribute . '>';
$output .= crp_get_the_post_thumbnail(array('post' => $result->ID, 'thumb_height' => $thumb_height, 'thumb_width' => $thumb_width, 'thumb_meta' => $thumb_meta, 'thumb_html' => $thumb_html, 'thumb_default' => $thumb_default, 'thumb_default_show' => $thumb_default_show, 'thumb_timthumb' => $thumb_timthumb, 'thumb_timthumb_q' => $thumb_timthumb_q, 'scan_images' => $scan_images, 'class' => 'crp_thumb', 'filter' => 'crp_postimage'));
$output.='<span class="crp_title">';
$output.= get_the_title($result->ID);
$output.='</span>';
$output .= '</a>';
$output.="</li>";
}
$output.="</div><ul>";
return $output;
} else
return "Pas d'articles relatifs";
}
else
return "fonction inexistante";
}
the result is json encapsulated then returned to the client side and managed by javscript.
Plugin Author
Ajay
(@ajay)
Thank you. I’ll look into this!