Add archive/category results to single post page

Figured it out. A conditional in content.php in template-parts/ checked whether the content is_archive. I assume the functionality behind is_archive is whether the file was launched from archive.php. Since it wasn’t it didn’t fire. Final step was redirecting to a custom content-post-type.php in template-parts that doesn’t have the is_archive check. Seems like it all works … Read more

Check if is post type archive and in category

You would just need to add your else if checks as needed. Category archives can be detected using is_tax( $taxonomy, $term ) or more specifically is_category( $term_id|$term_name ). // ADD ARCHIVE LAYOUT FOR POSITION VIDEOS POST TYPE function custom_filter_positionvids_layout( $layout_id ) { if ( is_post_type_archive( ‘position_video’ ) ) { return ’58bef4ba370de’; } if ( is_category( … Read more

Archive list for custom post type categories

How did you create the link with your category ’39’? Is it a custom taxonomy? Here’s the test i just did and it works fine: In functions.php i created the custom post type ‘recipe‘: add_action( ‘init’, ‘create_recipe’ ); function create_recipe() { register_post_type( ‘recipe’, array( ‘labels’ => array( ‘name’ => __( ‘Recipes’ ), ‘singular_name’ => __( … Read more

Showing only future posts in archive based on custom field date

The problem here is that, most probably, you store date in CF show_date in ‘YYYY-mm-dd’ format. You have to use the same format in comparisons… Something like this should work just fine: $args = array( ‘post_type’ => ‘esitykset’, ‘meta_key’ => ‘show_date’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_compare’ =>’>=’, ‘meta_value’ => date(‘Y-m-d’), ‘posts_per_page’ => 20, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)