Hi @baidoc,
Here is a code samples for use with author archives.
https://connekthq.com/plugins/ajax-load-more/docs/code-samples/author-archives/
You need to pass the author ID to ajax load more.
Thread Starter
baidoc
(@baidoc)
Thank you, that has worked.
Now I’m having another issue with the custom parameter.
I’ve the following query (which works)
$args = array(
'author' => $author,
'post_type' => 'post',
'posts_per_page'=> 3,
//'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => '_post_like_count'
);
$like_query = new WP_Query( $args );
if ( $like_query->have_posts() ) :
while ( $like_query->have_posts() ) : $like_query->the_post();
..
How would I integrate it with the Infinite Scroll?
Tried this method:
[ajax_load_more ... meta_key="meta_key" meta_value="_post_like_count" meta_compare="IN" ...]
Also tried this:
[ajax_load_more ... custom_args="meta_key:_post_like_count;orderby:meta_value_num" ...]
None from above seem to work.
Any idea why?
Hi @baidoc,
You were close with the first try.
Assuming you just want to order by the _post_like_count meta key
[ajax_load_more meta_key="_post_like_count" orderby="meta_value_num"]
Thread Starter
baidoc
(@baidoc)
It doesn’t return anything. Is there a way to see logs, or why it won’t return anything?
Nothing will be logged.
Your meta_key must be incorrect.
Can you explain exactly what you are trying to do. Maybe i’m missing something.
Thread Starter
baidoc
(@baidoc)
Thank you for the reply.
I’ve the following script integrated in my WordPress: https://hofmannsven.com/2013/laboratory/wordpress-post-like-system/
Basically it’s just a post like script, where anyone can like any post.
The Meta key for this script is: 'meta_key' => '_post_like_count'
I’m just trying to fetch user’s liked posts using your plugin but it doesn’t seem to work.
Ok. On that case you need to also pass in the other meta parameters for a complete meta query. I thought you were only ordering by the field.
meta_key=“_post_like_count” meta_compare=“=“ meta_type=“CHAR”
You might need to play around with the type and compare parameters. Hope that helps.
Thread Starter
baidoc
(@baidoc)
I don’t know why, but still can’t figure it out, and won’t work.
Also, from where did you get the meta_compare? I can’t see it anywhere on the shortcode builder page.
I also tried:
[ajax_load_more post_type=”post” author=”‘.$author.'” meta_key=”meta_key:orderby” meta_value=”_post_like_count:meta_value_num” meta_compare=”IN:IN” meta_type=”CHAR:CHAR” meta_relation=”AND”]
or:
[ajax_load_more post_type=”post” author=”‘.$author.'” meta_key=”:orderby” meta_value=”_post_like_count:meta_value_num” meta_compare=”IN:IN” meta_type=”CHAR:CHAR” meta_relation=”AND” orderby=”name”]
What else could I try?
meta compare is Meta Operator I think in the shortcode builder.
Open a ticket here if you want me to log in and try tix the issue for you.
https://connekthq.com/plugins/ajax-load-more/support/
Thread Starter
baidoc
(@baidoc)
Hi,
While preparing the Ticket for you and the page to send you, I noticed that it works when I insert directly through wp-admin (directly embedded into page)
BUT if I try using the do_shortcode function it won’t work.
What could be the reason for that? Should I still open the ticket?
Thank you!
A reason could be that there is already a loop on the page and it’s inferring with the Ajax query.