Custom post type in theme not appearing

The problem is most likely this part: ‘capability_type’ => array(‘newsletter’,’newsletters’), Try to remove it or adjust it accordingly. You should also prefix your functions to avoid possible name collisions. So replace: function post_type() { to e.g. function arcath_post_type() { and similarly: add_action(‘init’, ‘arcath_post_types’);

Urls in Custom Post Type work for Terms but not for its Taxonomies

[taxonomy_name] should be available in permalink automatically if you register it as register_taxonomy(‘kalendar’, [taxonomy_name], $args ); So Try this foreach($this->months as $month => $month_var) : $args = array( ‘labels’ => array(‘name’ => $month), ‘hierarchical’ => true, ‘rewrite’ => array( ‘slug’ => $month_var ), ‘query_var’ => true ); register_taxonomy($month_var, ‘kalendar’, $args); endforeach; Then Save Permalink Settings … Read more

Get template part with CPT and Custom Taxonomy conditionals

Your order of your if/else statement is wrong. You would want to have your complex condition (or most important condition) at the top and the simplest (or least important condition) at the bottom. if/else statements work on the basis that the first condition that hits true will be executed. In your example above, if you … Read more

Post format or Type for List Type Posts

You may simply use register_post_type and register_taxonomy to do so: function add_cpt_salads(){ $labels = array( ‘name’ => __( ‘Salads’, ‘your-text-domain’ ), ‘singular_name’ => __( ‘Salad’, ‘your-text-domain’ ), ‘menu_name’ => __( ‘Salads’, ‘your-text-domain’ ), ‘all_items’ => __( ‘All Salads’, ‘your-text-domain’ ), ‘add_new’ => _x( ‘Add new’, ‘Salads’, ‘your-text-domain’ ), ‘add_new_item’ => __( ‘Add New Salad’, ‘your-text-domain’ … Read more

Sort results without WP_QUERY?

If you want to change the order of an already existing query, you shouldn’t create a new WP_Query object but instead use pre_get_posts to alter the existing query, which prevents multiple queries running unnecessarily. From the pre_get_posts docs: This hook is called after the query variable object is created, but before the actual query is … Read more

Display list of custom post type which match taxonomy

Hopefully this will help out. https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters <?php $args = array ( ‘post_type’ => ‘cars’, ‘tax_query’ => array ( array ( ‘taxonomy’ => ‘car-types’, ‘field’ => ‘slug’, //or name or term_id ‘terms’ => ‘suv’, ) ) ); $car_query = new WP_Query($args);?> <?php if($car_query->have_posts()):?> <ul> <?php while($car_query->have_posts()): $car_query->the_post();?> <li> <a href=”https://wordpress.stackexchange.com/questions/217888/<?php the_permalink();?>”><?php the_title();?></a> </li> <?php endwhile; wp_reset_postdata(); … Read more