How to have the right design for a custom post type without accessing themes

Assuming that your custom post type is “songs”, I guess what you need is something like this: First, allow the theme to provide a design / template file for your custom post type, if WordPress can’t find one, fall back to your design, which you provided in your plugin folder. <?php // Template Logic: function … Read more

1 day after custom date change post status to draft

Your question isn’t very clear. Do you mean: 1 day after koncerter_start_date all posts with custom-post-type koncert have to get the status draft? EDIT Code: add_action( ‘wp_loaded’, ‘concert_daily_tasks’ ); function concert_daily_tasks() { $current_url = “https://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; if ( $current_url == ‘https://example.com/concert-daily-tasks’ ) { // <– set the correct URL! check_concert_status(); } } … Read more

Ordering Posts Type A by Custom Fields of related Post Type B

This works. The filters are tied to a custom ‘orderby’ term and removed after the query. $args = array( ‘post_type’ => ‘artworks’, ‘posts_per_page’ => -1, ‘no_found_rows’ => true, ‘order’ => ‘ASC’, ‘orderby’ => ‘artist_name_artwork_title’, ); add_filter(‘posts_join’, ‘name_join’, 10, 2 ); add_filter(‘posts_orderby’, ‘orderby_artist_name_artwork_title’, 10, 2); // query $wp_query = new WP_Query( $args ); remove_filter(‘posts_join’, ‘name_join’, 10 … Read more

Include woocommerce custom field value in front-end search result

You have to modify WooCommerce search query. Hook into this action: do_action( ‘woocommerce_product_query’, $query, $instance ); Detect if it is a search query Add your _subtitle meta Something like this (not tested): if ( $query->is_search ) { $query->set(‘meta_query’, array( array( ‘key’ => ‘_subtitle’, ‘value’ => $query->query_vars[‘s’], ‘compare’ => ‘LIKE’ ) )); };