order posts by date like craigslist

You may notice that I did more or less exactly this for Matt’s site: http://ma.tt. Every set of posts is grouped by the day. The basic principle is to keep track of your day in the loop, then print the date and related stuff only when it changes. Take a basic Loop: if ( have_posts() … Read more

Get date of last update outside of loop

It is unclear if you are looking for the last updated post or for the last updated date for some particular post. The answer by @PatJ assumes the former. To do the latter: $qry = new WP_Query(array(‘p’=>1)); var_dump($qry->posts[0]->post_modified); Or… $date = $wpdb->get_var(“SELECT post_modified FROM {$wpdb->posts} WHERE ID = 1”); var_dump($date); Of course you need to … Read more

Custom Post Type Archives by Date with Custom Permalink

Here’s the solution: Install Custom Post Type Archives plugin Go to Settings->Post Type Archives Remove the url base option (leave it blank) Change the template pattern to archive-{POST_TYPE}.php Tick your custom post type and click save Rewrite/save your custom permalink structure Now your links press-release/%year% and press-release/%year%/%month% should work.

How to List Events by Year and Month Using Advanced Custom Fields?

This should get you started: <?php $the_query = new WP_Query( array( ‘post_type’ => ‘kalender_item’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘kalender_item_datum’, ‘orderby’ => ‘meta_value’ ) ); # This will hold what group we’re in $current_header=””; # The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); # get the datum for this post $temp_date = get_post_meta( get_the_ID(), ‘kalender_item_datum’, … Read more

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