2016-08-04 111 views
0

我有三个图像可以在我正在使用的Wordpress主题上检索到。然而,没有任何图像实际上被检索到。截至目前,这是我的代码。我也试过get_stylesheet_directory_uri()(这没有帮助)。无法使用stylesheet_directory检索图像

<div class="col-md-4"> <img class = "img-responsive center-block" src ="<?php bloginfo('stylesheet_directory'); ?>/Assets/imgs/BlogReferral" alt = "Design"> 
</div><!-- End Col --> <div class = "col-md-4"> <img class = "img-responsive center-block" src ="<?php bloginfo('stylesheet_directory'); ?>/Assets/imgs/InstagramReferral" alt = "Code"> 
</div><!-- End Col --> 
    <div class = "col-md-4"> 
      <img class = "img-responsive center-block" src ="<?php bloginfo('stylesheet_directory'); ?>/Assets/imgs/ContactReferral" alt = "Design"> 
</div><!-- End Col -->   

回答

0

使用功能:get_template_directory_uri()功能。
映像路径将是:YOUR_THEME_FOLDER /资产/ IMGS/IMAGE_NAME

<div class="col-md-4"> <img class = "img-responsive center-block" src ="<?php echo get_template_directory_uri() ?>/Assets/imgs/BlogReferral" alt = "Design"> 
     </div><!-- End Col --> <div class = "col-md-4"> <img class = "img-responsive center-block" src ="<?php echo get_template_directory_uri(); ?>/Assets/imgs/InstagramReferral" alt = "Code"> 
     </div><!-- End Col --> 
      <div class = "col-md-4"> 
        <img class = "img-responsive center-block" src ="<?php echo get_template_directory_uri(); ?>/Assets/imgs/ContactReferral" alt = "Design"> 
     </div><!-- End Col --> 

如果使用儿童主题。那么你需要使用的功能get_stylesheet_directory_uri()

图像路径将是:YOUR_CHILD_THEME /资产/ IMGS/IMAGE_NAME

<div class="col-md-4"> <img class = "img-responsive center-block" src ="<?php echo get_stylesheet_directory_uri(); ?>/Assets/imgs/BlogReferral" alt = "Design"> 
     </div><!-- End Col --> <div class = "col-md-4"> <img class = "img-responsive center-block" src ="<?php echo get_stylesheet_directory_uri(); ?>/Assets/imgs/InstagramReferral" alt = "Code"> 
     </div><!-- End Col --> 
      <div class = "col-md-4"> 
        <img class = "img-responsive center-block" src ="<?php echo get_stylesheet_directory_uri(); ?>/Assets/imgs/ContactReferral" alt = "Design"> 
     </div><!-- End Col --> 
+0

谢谢您的回答!它仍然不检索图像! – mayaroy

+0

您是否使用儿童主题? @mayaroy – vrajesh

+0

我没有使用儿童主题@vrajesh – mayaroy