kalponikoronno

wp_add_inline_script

Dec 18th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. wp_add_inline_script();
  2.  
  3.  
  4.  
  5. wp_add_inline_script( string $handle, string $data, string $position );
  6.  
  7.  
  8.  
  9. array(
  10. 'id' => 'header_scripts',
  11. 'title' => esc_html__('Header Scripts', 'seo'),
  12. 'type' => 'textarea',
  13. 'desc' => esc_html__('Scripts goes before closing < / head >', 'seo')
  14. ),
  15. array(
  16. 'id' => 'footer_scripts',
  17. 'title' => esc_html__('Footer Scripts', 'seo'),
  18. 'type' => 'textarea',
  19. 'desc' => esc_html__('Scripts goes before closing < / body >', 'seo')
  20. ),
  21. array(
  22. 'id' => 'seo_custom_css',
  23. 'title' => esc_html__('Custom CSS', 'seo'),
  24. 'type' => 'textarea',
  25. 'desc' => esc_html__('Add your custom css here', 'seo')
  26. )
  27.  
  28.  
  29.  
  30. $header_scripts = cs_get_option('header_scripts');
  31. $footer_scripts = cs_get_option('footer_scripts');
  32. $seo_custom_css = cs_get_option('seo_custom_css')
  33.  
  34.  
  35. wp_add_inline_script( 'jquery-migrate', $header_scripts );
  36. wp_add_inline_script( 'seo-main', $footer_scripts');
  37. wp_add_inline_style( 'seo-style', $seo_custom_css );
Advertisement
Add Comment
Please, Sign In to add comment