Skip to content

Instantly share code, notes, and snippets.

@emadelawady
Created July 24, 2019 23:57
Show Gist options
  • Save emadelawady/800583373e95a08543c91fcaa208a8c6 to your computer and use it in GitHub Desktop.
Save emadelawady/800583373e95a08543c91fcaa208a8c6 to your computer and use it in GitHub Desktop.
<?php
/*
* Author: Ragnar
* Custom functions .
*/
/*------------------------------------*\
PROJECT_NAME External Modules/Files
\*------------------------------------*/
function custom_styles() {
$hold_styles_cdn = array(
'bootstrap' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css',
'fontawesome5' => 'https://use.fontawesome.com/releases/v5.5.0/css/all.css',
'slick' => '//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.css',
'slick-theme' => 'https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.min.css',
'bootstrap-toggle' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css',
'dyepie_animated' => 'https://cdn.jsdelivr.net/gh/Jack-McCourt/css3-animate-it/css/animations.css',
);
foreach ($hold_styles_cdn as $name => $src) {
wp_enqueue_style( $name, $src, array(), true );
}
$hold_styles_static = array(
'login_register' => 'login_register.css',
'dyepie-main' => 'dyepie.css',
);
foreach ($hold_styles_static as $name => $src) {
wp_enqueue_style( $name, get_template_directory_uri() . '/css/' . $src , array(), true );
}
if(is_page(array('log-in','register'))){
wp_enqueue_style( 'login_register', get_template_directory_uri() . '/css/login_register.css', array(), true );
}
}
add_action( 'wp_enqueue_scripts', 'custom_styles' );
// Custom func() for Scripts
function custom_scripts() {
$hold_scripts = array(
'dyepie_jquery' => 'https://code.jquery.com/jquery-3.3.1.min.js',
'bootstrap' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js?ver=4.9.8',
'slick' => 'https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js',
'bootstrap-toggle' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js',
'animate-it' => 'https://cdn.jsdelivr.net/gh/Jack-McCourt/css3-animate-it/js/css3-animate-it.js',
// validation
'validation' =>
'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js',
);
foreach ($hold_scripts as $script_name => $link) {
wp_register_script($script_name, $link, '','', true);
wp_enqueue_script($script_name);
}
// local scripts
wp_register_script('main-js', get_template_directory_uri() . '/js/script_name.js', '','', true);
wp_enqueue_script('main-js');
}
add_action( 'wp_enqueue_scripts', 'custom_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment