我想在我正在处理的Wordpress主题上检索三张图片。然而,没有一个图像实际被检索。这是我现在的代码。我也尝试了get_stylesheet_directory_uri()(没有帮助)。
<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 :(得分:0)
使用功能:get_template_directory_uri()
功能。
图片路径为:YOUR_THEME_FOLDER / Assets / 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 / Assets / 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 -->