Where is this JQuery coming from?

I understand that this loads JQuery throughout my website – but here’s the odd thing, if I change the version of JQuery is does NOT update. It’s not odd. You can’t load arbitrary versions of jQuery by changing the version argument. From the documentation for wp_enqueue_script(), that version number is: String specifying script version number, … Read more

I can’t add CSS with functions.php

Before adding any file you must seperate your header.php file & add wp_head() function in header.php file // Load the theme stylesheets function theme_styles() { // Example of loading a custom css file for homepage just on the homepage wp_register_style( ‘custom’, get_template_directory_uri() . ‘/css/custom.css’ ); if(is_page(‘home’)) { wp_enqueue_style(‘custom’); } // Example of loading a main … Read more

The correct way to add a JavaScript in the functions.php [closed]

function my_scripts() { // Register the script like this for a plugin: wp_register_script( ‘custom-script’, plugins_url( ‘/js/custom-script.js’, __FILE__ ) ); // or // Register the script like this for a theme: wp_register_script( ‘custom-script’, get_template_directory_uri() . ‘/js/custom-script.js’ ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( ‘custom-script’ ); } add_action( … Read more

Can’t add_action to ‘save_post’ and get it to fire

When editing a post using the admin interface the wp-admin/post.php script redirects you after saving the post. This is done to avoid resubmitting the post request if you refresh the page after submitting. It also means that you’re not able to output anything during the save_post action. case ‘editpost’: check_admin_referer(‘update-post_’ . $post_id); $post_id = edit_post(); … Read more