ho can I get the number of the current post instead of the post id?
It could be you need offset param in query $args = array( ‘posts_per_page’ => 1 // Display only 1 post ‘offset’ => 3 // Display 4th post ); $query = new WP_Query( $args );
It could be you need offset param in query $args = array( ‘posts_per_page’ => 1 // Display only 1 post ‘offset’ => 3 // Display 4th post ); $query = new WP_Query( $args );
First thing’s first — You’ll have to add that table. The way you do that if you were writing this in a plugin is as follows: function customtaxorder_init() { global $wpdb; $init_query = $wpdb->query(“SHOW COLUMNS FROM $wpdb->terms LIKE ‘term_order'”); if ($init_query == 0) { $wpdb->query(“ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT ‘0’”); … Read more
A reliable subscriber count is not possible, unless you require registration to access your RSS feeds. For example, my site is being autopolled by 5 other sites using auto aggregators, including 2 or 3 devices of mine, including Google Reader. I count as 1 subscriber, yet if I counted subscribers by how many accesses I … Read more
I answer to myself, since this code is working better (previous had an issue) and also I removed a useless “for”: echo ‘<ul class=”related-content”>’; $count = 0; foreach(get_field(‘related_content’) as $post_object) : $count++; if ($count > 0 && $count < 4 ) { printf(‘<li class=”large”><a target=”_blank” title=”‘.get_the_title($post_object->ID).'” href=”‘.get_permalink($post_object->ID).'”><span style=”display: block” title=”‘.get_the_title($post_object->ID).'”>’.get_the_post_thumbnail($post_object->ID, ‘small’).'</span><span class=”thumb-title”>’.get_the_title($post_object->ID).'</span></a></li>’); } elseif ($count … Read more
I found this plugin Bainternet Posts Creation Limits witch let you add how meny post a user, role or group can create. The plugin description says: Main Feature: Limit number of any post type creation. Select Post Status to count. (NEW) Limit number of any post type creation by user Role. (NEW) Limit number of … Read more
Replace the 11th line with the code below (untested): $term_list .= ‘<input type=”radio” name=”typ” value=”‘ . $term->slug . ‘”> ‘ . $term->name . ‘ Number of Posts:’. $term->count; It appears that get_terms has a post count return value.
How to get the count for each taxonomy term
Have you tried: wp_count_terms( ‘category’, array( ‘hide_empty’ => TRUE ) ); You can check out the source here.
Add minimum word count to Excerpt field To enforce a minimum word count for the Excerpt field before the Post status can be changed to pending, we will slightly alter s_ha_dum‘s code. It can be done by filtering wp_insert_post_data: function wcexcerpt($data){ if (!current_user_can(‘edit_others_posts’)) { $num = 5; // minimum word count if (str_word_count($data[‘post_excerpt’]) < $num) … Read more
My approach. No extra function, no filter. 🙂 <?php $GLOBALS[‘wpdb’]->current_post = 0; ?> <div <?php post_class( 0 === ++$GLOBALS[‘wpdb’]->current_post % 3 ? ‘third’ : ” ); ?>> Alternative: <div <?php post_class( 0 === ++$GLOBALS[‘wpdb’]->wpse_post_counter % 3 ? ‘third’ : ” ); ?>>