WP_Query to display number of custom post type filtered (order by) taxonomy

You could try running a custom query for each: $args_1 = array( ‘post_type’ => ‘incidents’, ‘post_status’ => ‘published’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘store’, ‘field’ => ‘name’, ‘terms’ => ‘store_1’, ), ), ); $count_1 = count( get_posts( $args_1 ) ); echo ‘Store 1: ‘ . $count_1 . ‘ posts’;

Some posts not displaying by taxonomy term

The problem is with your tax_query — the field (database column name) does not match the terms (database column values): $args = array( … ‘tax_query’ => array( array( ‘taxonomy’ => ‘state’, ‘field’ => ‘name’, // <- this should be set to ‘slug’ ‘terms’ => $state_slug, // because you provided term slug ), ), ); I.e. … Read more

Change the term based on the value of a $variable using wp_update_post in submitting a form

Your problem is this line: if (isset($_POST[‘call_16’]) == ‘No’ ) { isset() returns true or false based on whether the ‘call_16′ item exists in the $_POST array. It doesn’t return the value. So isset($_POST[‘call_16’]) is true, not ‘No’. If you want to check if it’s set and that it has a specific value (which you … Read more

How do i truncate content length to 500 words?

You could use a WordPress filter callback function. In your theme’s directory, create a file called functions.php and add the following in: <?php add_filter(“the_content”, “plugin_myContentFilter”); function plugin_myContentFilter($content) { // Take the existing content and return a subset of it return substr($content, 0, 500); } ?> The plugin_myContentFilter() function will be called each time you request … Read more

Custom Post Type has wrong label and is not found when called by a loop

The issue with the labels in problem 1 is that you haven’t passed the labels to register_post_type(). You’ve defined the labels in the $labels variable, but this is what you passed to register_post_type(): $args = array( ‘labels’ => ‘Bateau’, // … ); register_post_type( ‘bateau’, $args ); You need to pass the $labels array: $args = … Read more