Use WordPress Built In Jquery

The jQuery object is jQuery rather than $. See noConflict wrappers in wp_enqueue_script for some examples. jQuery(document).ready(function($) { // Inside of this function, $() will work as an alias for jQuery() // and other libraries also using $ will not be accessible under this shortcut });

Head Code for Custom Taxonomy

In this case you just need a conditional tag inside of the wp_head action. Placing the following on your functions.php will solve the problem: add_action( ‘wp_head’, ‘q166556_taxonomy_head’ ); function q166556_taxonomy_head(){ // Conditional for Taxonomy archives and posts that have any term from the taxonomy `store` if ( ! has_term( ”, ‘store’ ) && ! is_tax( … Read more

Adding a wp_head hook from an included PHP file

To enqueue styles and scripts properly, use the wp_enqueue_scripts action like so: function wpa_63708_enqueue_scripts() { wp_register_script( ‘my-script’,’/path/to/script’ ); wp_enqueue_script( ‘my-script’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_63708_enqueue_scripts’ );

new to javascript – using in instead of functions.php, not loading correctly

Start by putting your JS in an appropriate .js file in your theme directory. Use the wp_enqueue_scripts hook (this is where you will enqueue/load any of your custom javascripts). Within that hook, use wp_enqueue_script() to load your script(s). Example: add_action( ‘wp_enqueue_scripts’, ‘enqueue_my_stuff’ ); function enqueue_my_stuff () { wp_enqueue_script(‘slug_for_your_script’ , get_template_directory_uri() . ‘/path/to/yourscripts.js’, array(‘jquery’) ); }

Add OG meta tags to wp head

Well You can also try by adding action inside. function after_submission( $entry, $form ) { $name = $entry[2]; $item = $entry[5]; insert_og_in_head( $name, $item ); add_action( “wp_head”, “insert_og_in_head” ); } add_action( “gform_after_submission”, “after_submission”, 10, 2 ); function insert_og_in_head( $name = NULL, $item = NULL) { global $post; if ( !is_page( 6 ) ) //if it … Read more

How to output wp_enqueue_style() in HTML head instead of footer

hook into init action on your initial plugin function add_action(‘init’, array(__CLASS__, ‘your_function_within_class’)); and add the function public static function your_function_within_class() { wp_register_style(‘myfirstplugin-admin-css’, ‘/wp-content/plugins/myfirstplugin/assets/style.css’, false); wp_enqueue_style(‘myfirstplugin-admin-css’); } hope this help

Data validation for inline javascript

You can use addslashes() and stripslashes() to prepare any data for database entry. These are native PHP functions, not wordpress functions, so they do not necessarily need to be hooked anywhere specific in the wordpress load to work.