How to break a date from ACF?

Here you can get separated data from timestamp using date(); function. you can apply different fonts each value. <?php $timestamp = get_field(‘date_time’); $day = date(‘d’, $timestamp); $mon = date(‘m’, $timestamp); $year = date(‘Y’, $timestamp); echo “Day : “.$day.”<br>”; echo “Month : “.$mon.”<br>”; echo “Year : “.$year; ?> if $timestamp value “1567503270” then output will be … Read more

Ordering posts by publish date not working?

If the given code is correct it might be the missing brackets on your pre_get_posts conditional. Let’s format it with proper indentation and spacing: function alter_query( $query ) { if( $query->is_main_query() && is_home() ) $query->set( ‘cat’, ‘2’ ); $query->set( ‘orderby’, ‘rand’ ); } add_action( ‘pre_get_posts’,’alter_query’ ); Because there’s no brackets for your conditional statement, it … Read more

How to add a sortable date column in an admin page?

Just for people passing by, for putting together all this code was not trivial. The problem was actually the lack of data. I solved adding data as metakey (added in my case when the order changes status) and echoing it as the column value. So the full code is: // Adding a new column to … Read more