Reputation: 61
i don't know how to ask my doubt... i will try to make my question easy...
i created a new html file and tried to convert it into wordpress theme.. when i tried to include the files (image,js or anything) using "/sub-directory/filename" it is not including... when i change it into "http://localhost/wordpress/wp-content/themes/ashok/sub-directory/filename", it is working fine...
i don't know what is the problem... can u please help me...
Upvotes: 1
Views: 71
Reputation: 1
To use this function with subfolders in your theme directory, simply prepend the folder name before the slug. For example, if you have a folder called “partials” in your theme directory and a template part called “content-page.php” in that sub-folder, you would use get_template_part() like this: https://developer.wordpress.org/reference/functions/get_template_part/
<?php get_template_part( 'partials/content', 'page' ); ?>
Upvotes: 0
Reputation: 1464
<?php bloginfo('template_url'); ?>/images/image.png
Works with every type of file. If you need to include a template part, let's say search-form.php use:
<?php get_template_part('search-form'); // So, without .php extension ?>
Upvotes: 2
Reputation: 111
Try:
"<?php echo get_bloginfo('stylesheet_directory') ?>/sub-directory/filename"
Upvotes: 0