admin_url( 'admin-ajax.php' )) );
}
public function OCSSJS_insert_script_data($query)
{
if (!is_admin()) {
// Not a query for an admin page.
// It's the main query for a front end page of your site.
global $post, $wp_styles,$wp_scripts;
if(isset($post->ID)){
$post_id = $post->ID;
}
$s_count = count($wp_styles->queue);
$j_count = count($wp_scripts->queue);
if ($s_count > 0) {
$css = get_post_meta($post->ID, 'css_style_data', true);
if(!$css){
update_post_meta($post_id, 'css_style_data', $wp_styles->queue);
}
}
if ($j_count> 0){
$js = get_post_meta($post->ID, 'js_script_data', true);
if(!$js){
update_post_meta($post_id, 'js_script_data', $wp_scripts->queue);
}
}
}
}
public function OCSSJS_add_oredring_metabox()
{
add_meta_box('re_order', // ID attribute of metabox
'Re-Order JS & Css', // Title of metabox visible to user
'OCSSJS_re_order_inner_metabox', // Function that prints box in wp-admin
'page', // Show box for posts, pages, custom, etc.
'advanced', // Where on the page to show the box
'high'); // Priority of box in display order
}
}
function OCSSJS_re_order_inner_metabox($post)
{
$data = get_post_meta($post->ID, 'css_style_data', true);
$js = get_post_meta($post->ID, 'js_script_data', true);
//print_r($data);
$data_new= '';
$data_new.= '
For CSS & JS Reordering Once You Need To Reload Your Page From Front End Side.';
$data_new.= '
';
$data_new.= '
';
$data_new.= '
CSS Ordering
';
$data_new.= '';
$data_new.= '
';
if($data){
foreach($data as $d)
{
$data_new.= '
";
//Send the feedback and the new JS script order to the JavaScript
$ajaxResponse['feedback'] = $feedback;
$ajaxResponse['newJSOrder'] = $js_order;
echo json_encode($ajaxResponse, true);
die();
}
}
function OCSSJS_css_js_ordering_admin_notice(){
if ( is_admin() ) {
echo '
For CSS & JS Reordering Once You Need To Reload Your Page From Front End Side.