entire JS folder not loading in a WP theme

The problem is die(). You can’t die() inside a template or it will stop the entire site loading at that point. If you looked closer you’d notice that it wasn’t just the JS folder that wasn’t loading, it was the whole footer. You need to separate you code into 2 functions. One that outputs the … Read more

Post not populating for custom post type based on category selection

But this part is not executing → $args = array( ‘category_name’ => $taxonomy, ‘post_type’ => ‘video’, ‘posts_per_page’ => -1, It probably is. It’s just wrong. If you want to query posts by terms in a custom taxonomy you need to add a taxonomy query: $args = array( ‘post_type’ => ‘video’, ‘posts_per_page’ => -1, ‘tax_query’ => … Read more

WordPress and PHP Version Upgrade issue [closed]

The version of PHP used in the cli and your web server can vary depending upon your hosting and/or Apache configuration. Obviously, you are checking the command line interface version. You can use your cPanel to determine what versions of PHP Apache is using, you can install a PHPinfo type plug that shows the standard … Read more

Delete database record using plugin from admin panel

OK, so your code can’t work, because you use $wpdb->delete incorrectly. Let’s take a look at Codex. $wpdb->delete takes 3 params (one is optional): $table (string) (required) Table name. Default: None $where (array) (required) A named array of WHERE clauses (in column -> value pairs). Multiple clauses will be joined with ANDs. Both $where columns … Read more

trouble with parse error [closed]

Assuming the logic is correct, the fault lies in your PHP syntax. This would be correct: <?php if ( $detect->isMobile() ) { ?> <div> <?php wc_get_template_part( ‘checkout/layouts/test.php’ ); ?> </div> <?php } ?>

WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)

It has nothing to do with WP_Query itself. The reason for such problem is what you do with this WP_Query. There’s no the_post() in your code, so the loop is infinite. This is how to fix it: function bambam(){ $args = array( ‘category_name’ => ‘breaking-news’, ‘post_date’ => ‘DESC’, ‘posts_per_page’ => 1 ); $the_query = new … Read more

javascript variable to wordpress php variable

First you need to to send function name as additional data as $.ajax({ type: “POST”, url: compareids_ajax.ajax_url, data: { // Data object compareIDs : compareIDs, action: ‘your_ajax_function’ // This is required to let WordPress know which function to invoke }, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function (msg) { console.log( msg ); }, error: function … Read more

Local WordPress with WAMP downloads files out of Nowhere

So I’ve come to a conclusion after doing a couple of tests in my local environment. It appears whenever I go (literally just click) to the page to edit permalinks in the admin area, the .htaccess file changes it’s contents. I couldn’t figure out why exactly this happens because I couldn’t invest a whole lot … Read more