Get post id and enqueue scripts

//Enqueue
function hypxml_enqueue_files(){
global $post;
$page_array = array(195);
if(in_array($post->ID,$page_array)){
add_action('wp_print_scripts', 'hypxml_enqueue_js');
add_action('wp_print_styles','hypxml_add_stylesheet');
}
}
add_action('wp','hypxml_enqueue_files',5,0);

function hypxml_enqueue_js(){
wp_enqueue_script('hypxml_js', HYPXML_PLUGIN . 'scripts.js',array('jquery'));
wp_enqueue_script('hypxml_sort_js', HYPXML_PLUGIN . 'jquery.tablesorter.min.js',array('jquery'));
}
function hypxml_add_stylesheet(){ wp_enqueue_style('hypxml_styles', HYPXML_PLUGIN . 'style.css'); }

0 Comments

You must be logged in to post a comment.