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 } ?>

Hide DIV if empty – Plugin Gallery

This is just a matter of reorganising your PHP: $gallery = do_shortcode(‘[aigpl-gallery-slider id=”1080″ dots=”false” arrows=”false”]’); if ( ! empty( $gallery ) ) { echo ‘<div id=”photos” class=”block” style=”margin-top: 50% !important;”>’ … echo $gallery; echo ‘</div>’; }

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

Show metabox only for homepage

is_front_page() is only for use on the front-end to tell if the ‘main query’ is for the front page. In a back end context you need to check if the current post ID (which is in the $post passed to your callback function) is the same ID that’s set to be the front page. So … Read more