Hide title in Merlin Theme on posts and pages only

Your theme correctly uses the body_class function, which you can see by looking at the body tag. This means CSS classes are being added such as page or post that you can work with. e.g. body.page .entry-title { display: none; } There are many other CSS classes that may be useful to you, I suggest … Read more

Surrogate ID for posts, is there an alternative field in the posts table?

It depends on how are you importing those posts. You can use wp_insert_post() with import_id: $postToBeInserted = array( ‘post_title’ => ‘Your Post Title’, ‘post_content’ => ‘Your post content…’, ‘import_id’ => 154 ); wp_insert_post($postToBeInserted); If there is no post with the specified import_id the post will have that ID. That way you won’t have to deal … Read more

Is it possible to completely replace a post with an action/filter?

You can try with using pre_get_posts add_action(‘pre_get_posts’,’alter_query’); function alter_query($query) { //gets the global query var object global $wp_query; //gets the front page id set in options $front_page_id = get_option(‘page_on_front’); if ( ‘page’ != get_option(‘show_on_front’) || $front_page_id != $wp_query->query_vars[‘page_id’] ) return; if ( !$query->is_main_query() ) return; $query-> set(‘post_type’ ,’page’); $query-> set(‘post__in’ ,array( $front_page_id , [YOUR SECOND … Read more

Get query result according to merged array

Use orderby post__in $loop = new WP_Query( array( ‘post_type’ => ‘product’, ‘post__in’ => $posts, ‘paged’ => $paged, ‘posts_per_page’ => 5, ‘orderby’ => ‘post__in’ ) ); Remember it is only available from version 3.5