Skip to content

Instantly share code, notes, and snippets.

@goliver79
Created February 5, 2014 14:32
Show Gist options
  • Select an option

  • Save goliver79/8824805 to your computer and use it in GitHub Desktop.

Select an option

Save goliver79/8824805 to your computer and use it in GitHub Desktop.
[WORDPRESS] Register scripts, styles and shortcodes
<?php
/**
* register scripts
*
*/
add_action( 'init', 'lgpd_register_scripts' );
function lgpd_register_scripts(){
/* zebra datepickeer: http://stefangabos.ro/jquery/zebra-datepicker/ */
wp_register_script( 'js-zebra-datepicker', get_stylesheet_directory_uri() . '/inc/js/zebra_datepicker.js', array( 'jquery' ), '1.0' );
wp_register_script( 'js-lgpd', get_stylesheet_directory_uri() . '/inc/js/lgpd.js', array( 'jquery' ), '1.0' );
}
/**
* register styles
*
*/
add_action( 'init', 'lgpd_register_styles' );
function lgpd_register_styles(){
wp_register_style( 'css-zebra-datepicker', get_stylesheet_directory_uri() . '/inc/css/zebra/zebra_lgpd.css' );
wp_register_style( 'google-fonts-didact-gothic', 'http://fonts.googleapis.com/css?family=Didact+Gothic' );
}
/*
* enqueue scripts and styles
*/
add_action( 'init', 'lgpd_enqueue_scripts_styles', 10, 1 );
function lgpd_enqueue_scripts_styles(){
wp_enqueue_script( 'js-zebra-datepicker' );
wp_enqueue_script( 'js-lgpd' );
wp_enqueue_style( 'css-zebra-datepicker' );
wp_enqueue_style( 'google-fonts-didact-gothic' );
}
/*
* register shortcodes
*/
add_action( 'init', 'lgpd_register_shortcodes' );
function lgpd_register_shortcodes(){
add_shortcode( 'lgpd_cookies_policy_readmore', 'lgpd_cookies_policy_readmore' );
add_shortcode( 'lgpd_cookies_policy_text', 'lgpd_cookies_policy_text' );
add_shortcode( 'lgpd_privacy_policy_link', 'lgpd_privacy_policy_link' );
}
/*
* define shortcodes
*/
//..
function lgpd_cookies_policy_text(){
return( __( "This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.", "logopedicum" ) );
}
//..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment