Static front page and orderby
Static front page and orderby
Static front page and orderby
get_the_modified_author(); isn’t going to tell you who published the post, just who last edited it. You will need to capture you publisher yourself. function post_published_notification( $ID, $post ) { $publisher = wp_get_current_user(); update_post_meta($ID,’my_publisher’,$publisher); } add_action( ‘publish_post’, ‘post_published_notification’, 10, 2 ); Then use get_post_meta($post_id,’my_publisher’) to retrieve the data. Of course there are a numerous ways to … Read more
In you $args you need to make sure to order your categories like so: $args = array( ‘taxonomy’ => ‘category’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘hide_empty’ => 0 ); $c = get_categories($args); Did you make a custom taxonomy and use that within ACF?
Sorting in WP_List_Table class
The reason you can’t use ACF or functions such as the_title() is because they can only be accessed from inside The Loop (see here https://codex.wordpress.org/The_Loop). Its unnecessary to have multiple loops so I’ve merged them into one which will display any post data you need. Within this loop it checks whether the current post’s year … Read more
I think the simplest, but not necessarily the most performant, would be using two WP_Query loops, one using $query->set( ‘post__in’, $product_ids_on_sale ); and other using $query->set( ‘post__not__in’, $product_ids_on_sale ); because these are mutually exclusive. One loop would be used for the main query and other for second loop as show in this example in the … Read more
make two custom columns sortables
Just added: “<p style=\”display: none;\”>” . $rating . “</p>”;
I’ve used Jared’s approach several times successfully, although I agree that Stephen Harris’ answer should also now work (but it’s a more recent addition to WP_Query which wasn’t available at the time I was building an events listing). Depending on the date format you are suing to store the date, you might also need to … Read more
Go to the Page editor. Click the “Screen Options” box in the top right corner. In the dropdown, turn on the “Custom Fields” option. Now scroll down below the post editor area. Edit the fields as needed.