我在wordpress主题上为页脚分配了一个1px的边框,效果很好,但是沿着线条的某个地方,该边框出现在循环的顶部。我不确定我是否在某处缺少终端div或我做了什么,但是这让我发疯了!
这是我的header.php文件。
<DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo(charset); ?>">
<meta name="viewport" content="width=device-width">
<title><?php bloginfo('name'); ?></title>
<link href="https://fonts.googleapis.com/css?family=Abel|Dosis|Exo|Galada|Muli|Old+Standard+TT|Open+Sans+Condensed:300|Rajdhani|Raleway|Shrikhand|Bad+Script|Cinzel+Decorative|Allan" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Site Header -->
<header class="site-header">
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn"><i class="fa fa-cog"></i></button>
<div id="myDropdown" class="dropdown-content">
<?php wp_nav_menu (array('theme_location' => 'primary')); ?>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</header>
<!-- /Site Header -->
这是我的index.php文件,其中包含循环。
<div class="homepage-banner">
<div class="homepage-banner__bg-image" style="background-image: url(<?php echo get_theme_file_uri('/images/header3.png') ?>);">
</div>
<div class="homepage-banner__content">
<div class="headline-large">acetronaut</div>
<div class="headline-mid">fashion. beauty. lifestyle. adventure</div>
</div>
<div class="arrow"><a href="#content" class="arrow-button"><i class="fa fa-angle-double-down"></i></a>
</div>
</div>
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="acetronaut-half">
<div class="acetronaut-post" style="background-image:url(<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>);">
<div class="acetronaut-post-content">
<h2 class="acetrnt-post-category"><?php the_category(); ?></h2>
<h2 class="blog-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php echo get_the_excerpt(''); ?><a href="<?php the_permalink(); ?>">Continue Reading »</p>
</div>
</div>
</div>
<?php endwhile;
else :
echo '<p>No content Found</p>';
endif;
get_footer();
?>
</div>
这是我的footer.php文件。
<footer class="site-footer">
<?php
$args = array('theme_location' => 'footer')
?>
<nav class="site-nav"><?php wp_nav_menu( $args ); ?></nav>
<p><?php bloginfo('name'); ?> >> © <?php echo date('Y'); ?></p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
如果任何人都能找到问题所在,我将不胜感激。