Tag Info

New answers tagged

0

As of 3.7 you can use date_query http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters So it would look like: $args = array( 'posts_per_page' => 5, 'post_type' => 'post', 'post_status' => 'publish', 'date_query' => array( 'after' => date('Y-m-d', strtotime('-30 days')) ), ...


1

This quite an opinionated question as there are many methods which you can use to reach your end goal. There are a couple of questions you should ask yourself here first, like, do I need these posts to be part of my normal blog posts, what are these posts intended for, how often will I rotate them, or will they stay for a long length of time. Based on the ...


0

1.Download super post plugin 2.Go to Dashboard>Appearence>Widgets 3.Select the Super Post widget and drag it to sidebar 4.Expand Super post set IMPORTANT as title and select the type of post you want in it, the options are: Recent, most commented, sticky, related, Taxonomy: category or tags. 5.Choose category or tags, link the post that are important to ...


3

Yes of course. One of the ways to achieve this is by adding an extra category to your posts which you call 'sticky' or 'important' or something like that. For the example I will choose 'important'. To only get the important posts you can write a loop which loops through this category. For example: <?php $args = array( //arguments for the loop ...


0

Short answer: no. But if you want to use one loop for all your needed posts, you can do something like this: $args = array( 'post_type' => 'product', 'meta_query' => array( array( 'key' => 'cf_type', 'value' => 'fog', // need to have 10 with value 'fog' and 10 with value 'gof' ) ), ...


-1

You simply need to add the following line: <?php query_posts('post_type=post&paged='. get_query_var('paged')); ?> just before your get_posts() loop starts. Full article here


0

I created a new custom post type rather than using a page. Should have thought of that sooner: <?php $user_id = get_current_user_id(); $args = array( 'post_type' => 'user-review', 'posts_per_page' => 1, 'author' => $user_id ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo '<div ...


0

You need to use WP_Query. get_posts will only get you post =) <?php $user_id = get_current_user_id(); echo $user_id; $args=array( 'post_type' => 'page', 'post_status' => 'published', 'posts_per_page' => 1, 'author' => $user_id ); $wp_query = new ...


0

You can use the transition_post_status action to manipulate the post content at the time when it is published. You just need to add a function like the one below into your theme or plugin: function post_published( $new_status, $old_status, $post ) { if ( $new_status == 'publish' && $old_status != $new_status) { //Do whatever you want to ...



Top 50 recent answers are included