Add $values to post_class()
Multiple post classes should be separated by a single space or should be in an array. post_class(“$even_odd $current_post $current_in_total”); Or post_class(array($even_odd, $current_post, $current_in_total));
Multiple post classes should be separated by a single space or should be in an array. post_class(“$even_odd $current_post $current_in_total”); Or post_class(array($even_odd, $current_post, $current_in_total));
You should have a Posts menu item, like Pages. If it’s not visible, there is possibly code in your theme, or a plugin hiding the menu item. Look through your plugins and their options, and/or switch to a default theme to determine where this is happening.
Try this, nice and simple: <?php next_post(‘%’, ‘Prev: ‘, ‘yes’); ?> <?php previous_post(‘%’, ‘Next: ‘, ‘yes’); ?>
At first, read something about WordPress Ajax API and about Roles and Capabilities – capability to “edit_posts” has even Contributor. I would suggest to check for ‘delete_others_posts’ to prove the user is at least Editor. Or use capability of ‘manage_options’ (has Administrator, not Editor). Further, there is a check ajax referer function for you to … Read more
Following code generates the array to use as argument. <?php // Excluded CPTs. You can expand the list. $exclude_cpts = array( ‘portfolio’ ); // Builtin types needed. $builtin = array( ‘post’, ‘page’, ‘attachment’ ); // All CPTs. $cpts = get_post_types( array( ‘public’ => true, ‘_builtin’ => false ) ); // remove Excluded CPTs from All … Read more
I’m sure there is a more elegant way of achieving your desires, however this method does work. Just tested it. /** * Redirect pages from array. * * @author Michael Ecklund * @author_url https://www.michaelbrentecklund.com/ * * @return void */ function redirect_pages() { // Page from => Page to $redirect_pages = array( ‘wordpresspage’ => ‘/wordpress-page’ ); … Read more
This is because the paramenter posts_per_page of the get_posts() function defaults to 5. Set it to -1 in your $args.
It sounds like you want a filter on the_content. function add_content_wpse_97277($content) { global $post; if ($post->ID == 123) { $content .= ‘additional content’; } return $content; } add_filter(‘the_content’,’add_content_wpse_97277′); I don’t know what conditions you need though. You did not explain that in the question. The above should match a post with an ID of “123”. … Read more
There are two options: Create a separate single.php for posts and show the date there only. Use a condition: if ( is_single() ) { ?><div class=”date”><strong><?php the_date(); ?></strong></div><?php }
You can try this query that counts user comments by using the user_id field in the comments table as a filter: function count_user_comments_today( $uid ){ global $wpdb; $today = date(‘Y-m-d’); $tomorrow = date(‘Y-m-d’, time() + 86400); $count = $wpdb->get_var( $wpdb->prepare(“SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_date >= %s AND comment_date < %s … Read more