在我的php索引文件中插入包装器div时遇到了一个问题,我们正在使用该文件作为网站的首页。
现在看起来是这样的:
它需要如下所示:
我知道这是一个CSS问题,我能想到的解决方法是在主页上的这6个div周围插入一个包装div,但我不知道该将代码放在哪里,如下所示:
<?php get_header(); ?>
<?php global $woo_options; ?>
<?php if ( $woo_options[\'woo_featured_disable\'] <> "true" ) include( TEMPLATEPATH . \'/includes/featured.php\'); ?>
<?php
$args = array(
\'post_type\' => \'infobox\',
\'order\' => \'DESC\', // DESC for newer first.
\'orderby\' => \'date\',
\'posts_per_page\' => 6 // For a 3x2 grid.
);
$latest = new WP_Query( $args ); // You now have an object you can use in \'The Loop\'.
if ( $latest->have_posts() ) {
while ($latest->have_posts()) : $latest->the_post(); ?>
<div class="bskhp_t">
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<img src="<?php echo get_post_meta($post->ID, \'mini\', true); ?>" alt="" class="home-icon">
</a>
<div class="bskhp_f">
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<h3><?php the_title(); ?></h3>
</a>
<p class="mini-p"><?php echo get_post_meta($post->ID, \'mini_excerpt\', true); ?></p>
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<span>Read more</span>
</a>
</div>
</div>
<?php endwhile;
}
$v = array();
$upload_dir = wp_upload_dir();
$v[] = "<div class=\\"bskhp_vpv\\"><a href=\'https://www.youtube.com/watch?v=x6HQ4MFqMg0\' target=\'_blank\' style=\'color:#445567;font-family:arial;font-size:12px;font-weight:500\'><img style=\'padding:4px;border:1px solid #000000; width:180px; height:90px\' src=\'".$upload_dir["baseurl"]."/2015/04/video-capture-1.png\' width=\'180\' height=\'90\' vwidth=\'180\' vheight=\'90\' /><div style=\'color:#000000;font-family:arial;font-size:12px; padding:4px 0\'>Mental Health, Homelessness, and Stability in Housing.</div><p style=\'width:200px\'></p></a></div>";
$v[] = "<div class=\\"bskhp_vpv\\"><a href=\'https://www.youtube.com/watch?v=gnMt4_7Xc9M\' target=\'_blank\' style=\'color:#445567;font-family:arial;font-size:12px;font-weight:500\'><img style=\'padding:4px;border:1px solid #000000; width:180px; height:90px\' src=\'".$upload_dir["baseurl"]."/2015/04/video-capture-2.png\' width=\'180\' height=\'90\' vwidth=\'180\' vheight=\'90\' /><div style=\'color:#000000;font-family:arial;font-size:12px; padding:4px 0\'>2014 Key to Hope luncheon keynote address by Charles Gibson</div><p style=\'width:200px\'></p></a></div>";
$v[] = "<div class=\\"bskhp_vpv\\"><a href=\'https://www.youtube.com/watch?v=GKCJTTJq4KM\' target=\'_blank\' style=\'color:#445567;font-family:arial;font-size:12px;font-weight:500\'><img style=\'padding:4px;border:1px solid #000000; width:180px; height:90px\' src=\'".$upload_dir["baseurl"]."/2015/04/video-capture-3.png\' width=\'180\' height=\'90\' vwidth=\'180\' vheight=\'90\' /><div style=\'color:#000000;font-family:arial;font-size:12px; padding:4px 0\'>Plymouth Housing Group 2013 Documentary</div><p style=\'width:200px\'></p></a></div>";
$p = array();
$p[] = "<div><a href=\'https://www.plymouthhousing.org/about-us/publications/\'><img src=\'".$upload_dir["baseurl"]."/2015/04/publications-1.png\' height=\'254\' width=\'190\' /><div class=\\"bskhp_pcap\\">ANNUAL REPORTS</div></div>";
$p[] = "<div><a href=\'https://www.plymouthhousing.org/about-us/publications/\'><img src=\'".$upload_dir["baseurl"]."/2015/04/publications-2.png\' height=\'254\' width=\'190\' /><div class=\\"bskhp_pcap\\">FACT SHEET & MAPS</div></div>";
$p[] = "<div><a href=\'https://www.plymouthhousing.org/about-us/publications/\'><img src=\'".$upload_dir["baseurl"]."/2015/04/publications-3.png\' height=\'254\' width=\'190\' /><div class=\\"bskhp_pcap\\">NEWSLETTER</div></div>";
$mv = array();
$mv[] = "<h3 class=\'bskhp_h3\'>Our Vision</h3>Housing is just the beginning...the first step to building hope and transforming lives. We envision a day when every person has a home and a better quality of life.<p class=\\"bskhp_rm\\"><a href=\'https://www.plymouthhousing.org/about-us/mission-history/\'>READ MORE</a></p>";
$mv[] = "<h3 class=\'bskhp_h3\'>Our Mission</h3>Plymouth Housing Group works to eliminate homelessness and address its causes by preserving, developing and operating safe, quality, supportive housing and by providing homeless adults with opportunities to stabilize and improve their lives.<p class=\\"bskhp_rm\\"><a href=\'https://www.plymouthhousing.org/about-us/mission-history/\'>READ MORE</a></p>";
?>
早些时候,有人亲切地帮助我编写了这段代码,但这是漫长的一天,我的头一直在痛:)有人知道一个简单的解决方法吗?