Skip to content

Instantly share code, notes, and snippets.

View Ninetheme's full-sized avatar
🌴
On vacation

Ninetheme Ninetheme

🌴
On vacation
View GitHub Profile
@Ninetheme
Ninetheme / php-wp-enqueue-conditional-scriptload-before-dependent.php
Created September 26, 2022 12:09 — forked from rxnlabs/php-wp-enqueue-conditional-scriptload-before-dependent.php
WordPress - enqueue javascript data based on WordPress conditions and other scripts. Load scripts tags before and after dependent script loads
<?php
function load_scripts(){
global $wp_scripts;
wp_register_script( 'theme-scripts', get_bloginfo('template_url').'/js/scripts.js', array('jquery'), '1.0', true );
//if we're on the woocommerce checkout page
if( is_checkout() ){
$wp_scripts->add_data('theme-scripts','data','<!--START SCRIPT STRING-->
// script to load before name-of-enqueued-script loads
@Ninetheme
Ninetheme / gist:2533cd520191fe3809361cd70964f0bb
Created November 26, 2016 14:16
undefined ot_get_option solution
if ( ! function_exists( 'ot_settings_id' ) ) {
function ot_get_option() {
return false;
}
}
if ( function_exists( 'ot_settings_id' ) ) {
// add filter for options panel loader