Custom Page that comes with preloaded content for the user

You can do this like this: (answering from mobile. Please forgive if the markup is broken) add_filter( ‘default_content’, ‘preloaded_editor_content’, 10, 2 ); function preloaded_editor_content( $content, $post ) { switch( $post->post_type ) { case ‘your_post_type’: $content=”your content”; break; default: $content=”your default content”; break; } return $content; }

Shops listing (CPT VS Plugin)

To display the data from your Custom Post Type you can create a post template single-shop.php (for example) and place this in your theme folder. NOTE: The filename must match the name of your CPT – ie single-{your_post_type}.php. Then in this template you can display your data with the_field() – eg: <?php the_field(‘opening_hours’); ?> The … Read more

Ajax Check Post Status

So basicly you want an ajax method that checks for post changes. Here’s a great article on WP ajax for front & back-end. In short you want to do the following: Load the Ajax JS script on the pages you want to show the notification popup. Create wp ajax server-side handling, with hook wp_ajax_{your_custom_action}. OR … Read more

Tag page with Custom Post Types not returning any posts

WordPress, by default, shows only posts on tags and categories archives… So if you want to show your custom post type in there, then you’ll have to make WordPress do that… function add_news_articles_to_categories_and_tags( $query ) { if ( ! is_admin() && $query->is_main_query() && ($query->is_category || $query->is_tax ) ) { $query->set( ‘post_type’, array(‘post’, ‘news_article’) ); // … Read more

get_posts of Custom Post Type AND Custom Taxonomy

You use multiple taxonomies at once, so use’relation’ => ‘AND’: <?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘products’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, // this is what was missing array( ‘taxonomy’ => ‘subjects’, ‘field’ => ‘name’, ‘terms’ => $shortcode_atts[‘subject’], ), array( ‘taxonomy’ => ‘plans’, ‘field’ => ‘name’, ‘terms’ => … Read more