【发布时间】:2017-09-27 17:02:26
【问题描述】:
在我的 page.php 中,我试图在 .page-wrapper div 中输出特色图像,并在页面顶部使用 style="background-image: url('<?php echo $thumb['0'];?>') !important;" 显示(内联 css)
问题是它不断被浏览器划掉。可能是因为有一个 3rd 方插件并且可能会覆盖它 - 所以我尝试将 !important 标签添加到我的属性中。不工作。而且我禁用了插件,没有运气。想法??
页面链接:http://radian3.com/events/
这是page.php
<div class="about-container">
<!-- The POST LOOP -->
<?php if(have_posts()) :
while (have_posts()) : the_post(); ?>
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
<div class="page-wrapper" style="background-image: url('<?php echo $thumb['0'];?>') !important;">
<b class="about-title"><?php the_title(); ?></b>
<!-- <div class="about-icon-wrapper" style="background-image: url('<?php echo $thumb['0'];?>')"></div> -->
</div>
<div class="contact-body-wrapper">
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<?php else :
echo '<p>No content found..</p>';
endif;
?>
CSS
/* single.php page */
.page-wrapper {
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
/* background-image: url('../img/about-our-team.jpg') !important;
*/ height: 30rem;
background-repeat: no-repeat;
background-size: cover;
}
【问题讨论】:
标签: php jquery html css wordpress