Date of last blog update for specific authors only?

Ok, Paul, So I took a few minutes to figure this out (assuming this is where you’re going with this): Here’s the MySQL query that will give you the latest post date, one user at a time: SELECT post_date FROM wp_posts WHERE post_author = 1066 ORDER BY post_date DESC LIMIT 1 (The number “1066” is … Read more

WordPress + Isotope: how to give different widths to each entry?

On the div that immediately wraps each post, you can use php to randomize the values instead of hardcoding the col-12 and col-sm-6 classes. For example, you could change <div class=”col-12 col-sm-6 <?php echo $termsString; ?> grid-item wow fadeInUp”> to reflect the randomizer and then its result: <?php $randomColClasses=”col-” . rand(8,12); //random value between 8-12 … Read more

How to sort (orderby) a query done by a template function before the ‘foreach’ loop?

Without knowing what Realia_Post_Type_Property::get_properties() does and returns, this is a bit tricky to answer. But essentially, you want to to sort an array using PHP. Unless Realia_Post_Type_Property::get_properties() allows you to get a sorted list of posts, your best bet is probably to use wp_list_sort(). That function sorts a list of objects, based on one or … Read more

Loop and output 4 rows of posts on home page

Lets see on your structure. You have 2 block, and each block have 2 lines. First line of block have 2 posts, second line – 3 posts. See screen First we chunk array to 5 per each chunk; Next step wee need separate each array with 5 posts to 2 and 3 posts. Than print … Read more

sorting in wp query based on custom field value

“’orderby’ => $company_name,” should be “’orderby’ => ‘meta_value’,“ If the value of _company_name is numeric – it should be meta_value_num. Note that ‘orderby’ can only have a predefined value and ordering does it alphabetical See the possible values at the WP_Query orderby parameter: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters The ordering parameter says: Order alphabetical by the values of meta_key … Read more