@sterndata
function samtemehr_index_scripts() {
if ( is_page_template( 'index.php' ) ) {
wp_enqueue_style( 'samtemehr-index-min', get_stylesheet_directory_uri() . '/css/index.min.css');
wp_enqueue_script( 'samtemehr-index-min', get_stylesheet_directory_uri() . '/js/index.min.js' );
}
}
not loaded.
-
This reply was modified 7 years, 5 months ago by
samtemehr.
Did you add the “add_action” line?
add_action('wp_enqueue_scripts', 'samtemehr_index_scripts' );
@sterndata
not loaded…
function samtemehr_index_scripts() {
if ( is_page_template( 'index.php' ) ) {
wp_enqueue_style( 'samtemehr-index-min', get_stylesheet_directory_uri() . '/css/index.min.css' );
wp_enqueue_script( 'samtemehr-index-min', get_stylesheet_directory_uri() . '/js/index.min.js' );
}
}
add_action( 'wp_enqueue_scripts', 'samtemehr_index_scripts' );
function et_load_samtemehr_scripts() {
$template_dir = get_template_directory_uri();
$theme_version = et_get_theme_version();
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'samtemehr-superfish', $template_dir . '/js/jquery.cookie.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-fitvids', $template_dir . '/js/jquery.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-flexslider', $template_dir . '/js/jquery.flexslider.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-bootstrap', $template_dir . '/js/bootstrap.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_style( 'samtemehr-bootstrap', $template_dir . '/css/bootstrap.min.css' );
wp_enqueue_style( 'samtemehr-iconic-font', $template_dir . '/css/iconic.min.css', $theme_version, true);
/*
* Loads the main stylesheet.
*/
wp_enqueue_style( 'samtemehr-style', get_stylesheet_uri(), array(), $theme_version );
}
add_action( 'wp_enqueue_scripts', 'et_load_samtemehr_scripts' );
if ( ! function_exists( 'et_get_theme_version' ) ) :
function et_get_theme_version() {
$theme_info = wp_get_theme();
if ( is_child_theme() ) {
$theme_info = wp_get_theme( $theme_info->parent_theme );
}
$theme_version = $theme_info->display( 'Version' );
return $theme_version;
}
endif;
-
This reply was modified 7 years, 5 months ago by
samtemehr.
-
This reply was modified 7 years, 5 months ago by
samtemehr.
-
This reply was modified 7 years, 5 months ago by
samtemehr.
I don’t see that you included the code I specified.
my code is this.
But not loaded…
function et_load_samtemehr_scripts() {
$template_dir = get_template_directory_uri();
$theme_version = et_get_theme_version();
wp_enqueue_script( 'samtemehr-superfish', $template_dir . '/js/jquery.cookie.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-fitvids', $template_dir . '/js/jquery.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-bootstrap', $template_dir . '/js/bootstrap.min.js', array( 'jquery' ) , $theme_version, true );
wp_enqueue_style( 'samtemehr-bootstrap', $template_dir . '/css/bootstrap.min.css' );
wp_enqueue_style( 'samtemehr-iconic-font', $template_dir . '/css/iconic.min.css', $theme_version, true);
wp_enqueue_style( 'samtemehr-style', get_stylesheet_uri(), array(), $theme_version );
//***** this is your code *****//
if ( is_page_template( 'single.php' ) ) {
wp_enqueue_script( 'samtemehr-index', $template_dir . '/js/index.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_style( 'samtemehr-index', $template_dir . '/css/index.min.css', $theme_version, true );
}
}
add_action( 'wp_enqueue_scripts', 'et_load_samtemehr_scripts' );
I found. 🙂
function et_load_samtemehr_scripts() {
$template_dir = get_template_directory_uri();
$theme_version = et_get_theme_version();
wp_enqueue_script( 'samtemehr-superfish', $template_dir . '/js/jquery.cookie.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-fitvids', $template_dir . '/js/jquery.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'samtemehr-bootstrap', $template_dir . '/js/bootstrap.min.js', array( 'jquery' ) , $theme_version, true );
wp_enqueue_style( 'samtemehr-bootstrap', $template_dir . '/css/bootstrap.min.css' );
wp_enqueue_style( 'samtemehr-iconic-font', $template_dir . '/css/iconic.min.css', $theme_version, true);
wp_enqueue_style( 'samtemehr-style', get_stylesheet_uri(), array(), $theme_version );
//***** this is your code *****//
if ( !is_single() ) {
wp_enqueue_script( 'samtemehr-index', $template_dir . '/js/index.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_style( 'samtemehr-index', $template_dir . '/css/index.min.css', $theme_version, true );
}
if ( !is_front_page() ) {
wp_enqueue_script( 'samtemehr-content', $template_dir . '/js/newstext.min.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_style( 'samtemehr-content', $template_dir . '/css/newstext.min.css', $theme_version, true );
}
}
add_action( 'wp_enqueue_scripts', 'et_load_samtemehr_scripts' );