Category page only displaying the posts from a custom type

Ok I found a solution by following the recommandation of s_ha_dum to use pre_gets_posts. All the following code goes to functions.php 1 Create a new rewrite rule function rewrite_clean() { // my CPTs $types = array(‘projects’, ‘works’); foreach($types as $type) { add_rewrite_rule(‘^’.$type.’/([^/]*)/?$’, ‘index.php?post_type=”.$type.”&term=$matches[1]’,’top’); } } add_action(‘init’, ‘rewrite_clean’); transform the following format ?post_type=projects&term=architecture to the following … Read more

How to make checkboxes from taxonomy terms?

$taxonomy = ‘training_cats’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 0; // 1 for yes, 0 for no $title=””; $empty = 0; $args = array( ‘name’ => $taxonomy, ‘orderby’ => $orderby, ‘show_count’ => $show_count, ‘pad_counts’ => $pad_counts, … Read more

Taxonomy Templates

According to the Codex: taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php What I do when using custom taxonomy/custom post types is exactly what you mentioned in the second sentence. Make a page template and a page in the back end. Choose the template you built as the template to use … Read more

Adding a class to tag list in a function

If you are passing the before parameter that you can simply add any class that you want. You then style that class in style.css. <?php if ( get_the_tag_list() ) { echo get_the_tag_list(‘<ul class=”tag-list”><li class=”tag-item”>’,'</li><li class=”tag-item”>’,'</li></ul>’); } ?>

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