افزودن آدرس پوشه قالب به یک تصویر

برای اینکه یک تصویر در قالب نمایش داده شود باید ادرس پوشه قالب قبل از ادرس تصویر صدا زده شود:

// Get template directory example:
<img src="/<?php echo get_template_directory_uri(); ?>/images/logo.png" />

// If you use child theme you will have to use another function:
<img src="/<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png" />
  
<img src="/<?php echo get_template_directory_uri(); ?>/images/logo.png">

include( get_template_directory_uri() . '/includes/my_file.php' );

add_action('wp_enqueue_scripts', 'wpdocs_scripts_method');
 
/*
 * Enqueue a script with the correct path.
 */
function wpdocs_scripts_method() {
    wp_enqueue_script(
        'custom_script',
        get_template_directory_uri() . '/js/custom_script.js',
        array('jquery')
    );
}
نظرات کاربران
ثبت نظرات
برای ثبت نظر باید عضو سایت باشید!