WordPress blog directory vs template directory functions.

/*This uses blog directory for local images inside of my theme with no parent theme*/ <img src="<?php bloginfo('template_directory'); ?>/images/laptop_2.jpeg" class="logo-light" alt="#"> /*This function enqueues css inside of a theme with no parent theme*/ wp_enqueue_style( 'pluginsCss', get_template_directory_uri() . '/css/plugins.css',true,'1.1','all'); /*This uses template directory for local images inside of a child theme with a parent theme*/ <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/laptop_2.jpeg"/> /*This function enqueues css inside of a child theme with a parent theme*/ wp_enqueue_style( 'mods', get_stylesheet_directory_uri() . '/css/mods.css',true,'1.1','all');

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.