Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
- if ( 394283 === $settings['list_id'] ) {
- $post_ids = array();
- $posts = get_posts($args);
- foreach($posts as $post){
- $post_ids[] = get_object_vars($post)['ID'];
- }
- if ( $posts ) {
- $move_to_front = array( 87, 282 );
- $post_ids_merged = array_merge( $move_to_front, $post_ids );
- $reordered_ids = array_unique( $post_ids_merged );
- $args['post__in'] = $reordered_ids;
- $args['orderby'] = 'post__in';
- $args['order'] = 'ASC';
- }
- }
- return $args;
- },10,2);
Advertisement
Add Comment
Please, Sign In to add comment