Custom post type and taxonomy permalinks – Structure

Been trying to get a nest of custom post type and taxonomy working (even took a look here) but couldn’t get it working 100%. Here is the thing, I created a custom post type texturas_temp and a custom taxonomy inside it categorias_texturas_temp. What I would like to do is to get this structure: /texturas_temp/ <- … Read more

Double count view in archive.php

I’m having a hard time using this snippet I’m getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0”; } return $count; } function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, … Read more

WordPress custom post type archive with description

I have a common design pattern I’m not entirely sure how to best execute in WordPress. The layout is a listing of post teasers (title, trimmed body, image) on an overview page. Let’s say example.com is a boating safety company, and at example.com/classes there’s a listing of their posts of the class type using archive.php … Read more

Custom template for archive of a custom taxonomy

I’ve made a custom taxonomy named activities, containing items named local, member, and national: <?php function add_custom_taxonomies() { register_taxonomy(‘Activities’, ‘post’, array( ‘has_archive’ => true, ‘hierarchical’ => true, ‘labels’ => array( // labels goes here ), ‘rewrite’ => array( ‘slug’ => ‘activities’, ‘with_front’ => true, ‘hierarchical’ => true ), )); } add_action( ‘init’, ‘add_custom_taxonomies, 0 ); … Read more

Display only posts from referred category on date archive page

I am using wp_get_archive() in category.php. If I am on page of category=2 it should show my archives of only that category. However it is for all the categories. Following is the code for my category.php as well as archive.php <?php get_header(); ?> <?php $args =array( ‘posts_per_page’ =>1, ); $loop = new WP_Query( $args ); … Read more