Can’t Find a Way to Edit the Home Page Content [closed]

That’s because most probably your theme’s index.php is including somewhere the content of the template via a function (i.e. get_template_part()). Also, all your page’s contents are (and should be) stored in the database and displayed via queries; the contents are not (and they shouldn’t be) hard-coded in any file. Usually when you want to edit … Read more

Ajax call to my WordPress website from an external application [duplicate]

You shouldn’t be sending your data as JSON: dataType: “JSON” For add_action(“wp_ajax_nopriv_itempricingfunction” to work, WordPress needs to find the action parameter in your request, which you’re correctly setting here: data: { action : “itempricingfunction”, ean : “EANTEST0101010” }, The problem is that it checks this using $_REQUEST[‘action’], but PHP doesn’t populate $_REQUEST with JSON. It … Read more

How to use wp-ajax in wp-cron

First of all, think about using the new REST API instead of Admin-AJAX in your environment where JavaScript is available. Now to answer your question: JavaScript isn’t available for wp-cron, as these requested solely run on the server and not on some interpreted HTML/JavaScript. So what can you do? Well, just schedule another event if … Read more

How to check for WordPress timezone type?

If we want to work with php’s datetime features and timezone objects AND handle sites that use a gmt_offset, sadly it does require some trickery. I have not found a better way to do it than this: Check for timezone string first – got one – great! Else Check for gmt offset, then try to … Read more

POST from jQuery to PHP

When you load your process.php file directly, it’s not within the context of the WordPress environment, so no WordPress functions are available. WordPress has a native AJAX API that should be used for this sort of thing. First, enqueue your javascript file, then use wp_localize_script to pass the location of admin-ajax.php, which will be processing … Read more

Add jQuery to WordPress page

I think wordpress only loads jQuery when you specify it is a dependency for another script that is loading on that page: wp_enqueue_script( ‘script-name’, ‘/path/script.js’, array(‘jQuery’); If there is no other script then try loading it like a normal script with full path to the file: wp_enqueue_script( ‘myJquery’, ‘//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js’);