Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function show_post_of_the_day( $query ) {
- if ( $query->is_home() && ! is_admin() && $query->is_main_query() ) {
- $today = getdate();
- $args = array(
- 'post_type' => 'post',
- 'date_query' => array(
- array(
- # 'year' => 2012,
- 'month' => $today['mon'],
- 'day' => $today['mday'],
- ),
- ),
- );
- $new_query = new WP_Query( $args );
- $permalink = home_url('/');
- while( $new_query->have_posts() ) {
- $new_query->the_post();
- $permalink = get_permalink();
- } wp_reset_postdata();
- #echo $permalink;
- header( 'Location: '. $permalink );
- }
- } add_action( 'pre_get_posts', 'show_post_of_the_day' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement