chriddell
Forum Replies Created
Viewing 5 replies - 1 through 5 (of 5 total)
-
Forum: Plugins
In reply to: [MC4WP: Mailchimp for WordPress] AJAX responseThanks for being so clear Danny.
Could you point me in the direction of which hooks I should be using?
Thanks,
ChrisThe answer is, yes, you can.
It’s as simple as ‘orderby=”post__in”‘.
¯\_(ツ)_/¯
I have a custom function which allows me to order by date. See below:
function wpse147412_order_terms_by_post_date( $pieces, $taxonomies, $args ) { global $wpdb; if ( 'post_date' !== $args['orderby'] ) { return $pieces; } $args = wp_parse_args( $args, array( 'post_types' => 'post' ) ); $pieces['fields'] = 'DISTINCT ' . $pieces['fields']; $pieces['join'] .= " JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $pieces['join'] .= " JOIN $wpdb->posts AS p ON p.ID = tr.object_id"; $pieces['where'] .= " AND p.post_type IN ('" . implode( "', '", (array) $args['post_types'] ) . "')"; $pieces['orderby'] = 'ORDER BY p.post_date'; return $pieces; } add_filter( 'terms_clauses', 'wpse147412_order_terms_by_post_date', 10, 3 );Brilliant. Thank you.
For everyone’s clarification, here is working code:
echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="1" scroll_distance="0" max_pages="0" images_loaded="true" container_type="div" exclude="' . $current . '" transition="slide" pause="true" pause_override="true"]');You’re great, thank you.
Setting
pause="true"stops the pages loading in at all (on scroll), though. No biggie, I can fix with some JS anyway.
Viewing 5 replies - 1 through 5 (of 5 total)