WordPress: Cron locking and Queue

Simple Cronjob Walker Create a CPT cronjob for your cronjobs. Add the relevant post meta data (action, last_executed,… and whatever you need) Create a walker function function my_cronjob_walker() { $args= array( ‘post_type’ => ‘cronjob’, ‘posts_per_page’ => 1, ‘meta_key’ => ‘last_executed’ ‘orderby’ => ‘meta_value’, ); $cronjob = new WP_Query($args); if ($cronjob->have_posts()) while ($cronjob->have_posts()) { $cronjob->the_post(); // … Read more

WordPress Bootstrap Grid

In my opinion, you should use wp-query. Using a sidebar for this purpose will yield problems in the long term. SEO: Sidebars are taken as “aside” content, which is considered less relevant content by search engines. Editor: The editors for the sidebars are much worse than post editors. Reliability: Any change to containers added in … Read more

Conditional posts in WP_query for search

What about removing the if statement, and combining the queries into something like this: ‘meta_query’, array( ‘relation’ => ‘OR’, array( array( ‘relation’ => ‘AND’, array( ‘key’ => ‘am_get_recurring_count’, ‘compare’ => ‘=’, ‘value’ => ‘0’, ), array( ‘relation’ => ‘OR’, array( ‘key’ => ‘am_enddate’, ‘compare’ => ‘>=’, ‘value’ => $currentdate, ), array( ‘key’ => ‘am_enddate’, ‘compare’ … Read more

How to allow Readers to Select Post Order?

What you need here is Ajax. You will need to read about how to use WordPress Ajax (link). When your visitor click on select field to choose sorting, you need a JS function to handle the data about how to sort and where the visitor in, then a js function to make ajax request to … Read more

How To Call WP_Query From A Subdomain?

Why don’t you try using the WP API? You could then pull posts from a URL like this … http://subdomain.example.com/wp-json/posts You can also set custom post types to use the WP API and then access them also in a similar manner, you would need to add the following to your CPT args: $args = array( … Read more

Fetching $_POST from Page Template into functions.php

Assign the value of you $_POST variable to a html element or javascript variable in front-page.php like //html element <input type=”hidden” value=”<?= $_POST[‘variable’]?>” id=”post-variable”> or in javascript variable var postVariable = “<?= $_POST[‘variable’]?>”; Now in ajax call, you can get the value as var myValue = jQuery(‘#post-variable’).val(); //if you set value to html element or … Read more