User count only for role frontend vendor

to get the number of authors who are assigned a particular role the get_users() function should do it: $args = array( ‘role’ => ‘frontend_vendor’,//substitute your role here as needed ‘fields’ => ‘ID’, ); $users = get_users( $args ); $user_count = count( $users );

Taxonomy count per Post type

I needed to get the number of post per type per term so i created this small function: function get_term_post_count_by_type($term,$taxonomy,$type){ $args = array( ‘fields’ =>’ids’, //we don’t really need all post data so just id wil do fine. ‘posts_per_page’ => -1, //-1 to get all post ‘post_type’ => $type, ‘tax_query’ => array( array( ‘taxonomy’ => … Read more

Display Count of posts

You should be able to get that number from the same $wp_query object: global $wp_query; $num_pages = $wp_query->found_posts; $num_pages will contain the total count that matches your category (or whatever other criteria you’re using). If you’re just looking to get a string you can display, this modified version of the function will work. function get_post_number() … Read more

Custom Looping of WordPress Posts

Hi I believe this should work <div class=”col-xs-8″> <?php $count = 1; ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if $count = 1; ?> <!– First post Wrapper–> <div class=”first-post”> <article class=”post1″></article> </div> <!– Rest all post Wrapper–> <div class=”all-posts”> <?php else : ?> <article class=”post<?php echo … Read more

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