WordPress files Question

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…

Read More

i don’t know what is the problem… can u please help me…

Related posts

Leave a Reply

3 comments

  1. <?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 ?>
    
  2. 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' ); ?>