Wsparcie » Motywy » Problem z szalbonem po dodaniu pętli

  • Witam. Piszę mój szablon na zaliczenie. Mam jednak jeden mały problem. Po dodaniu pętli WP (do wyświetlania artykułów) robi mi się niepotrzebna przerwa między header i section oraz między section i footer (pętlę dodaję w section). Czy jest jakaś możliwość zlikwidowania tej przerwy?

    Kod pliku header.php

    <!DOCTYPE html>
        <html>
        <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="<?php bloginfo( 'template_url' ); ?>/reset.css" type="text/css" />
        <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" />
        <?php wp_head(); ?>
        </head>
        <body>
        <nav>
        <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
        </nav>

    Kod pliku index.php

    <?php get_header(); ?>
        <section>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <div class="entry">
        <a href=""></a>
        <?php the_content('czytaj dalej'); ?>
        <div class="clear"></div>
        </div> <!-- end entry -->
        <?php endwhile; else: ?>
        <p><?php _e('Przepraszamy ale nie ma artykułów spełniający kryteria.'); ?></p>
        <?php endif; ?>
        </section>
        <?php get_footer(); ?>

    Kod pliku footer.php

    <footer>
        footer
        <?php wp_footer(); ?>
        </footer>
        </body>
        </html>

    Kod pliku style.css

    body{
           text-align: center;
           background: grey;
        }
        a{
           color: white;
           text-decoration: none;
        }
        li{
           list-style: none;
        }
        header, nav, section, footer{
           background: green;
           margin-left: auto;
           margin-right: auto;
           width: 800px;
        }
        section, footer{
           color: white;
           text-align: left;
        }

    i zdjęcie

Viewing 1 replies (of 1 total)
  • spróbuj tak:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="content">
    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    <a href="<?php the_permalink(); ?>">
    <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'single-post', array('class' => 'content-thumb') ); } ?>
    </a>
    <?php the_content('Czytaj Więcej'); ?>
    <div class="clear"></div>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php get_footer(); ?>

Viewing 1 replies (of 1 total)
  • Temat ‘Problem z szalbonem po dodaniu pętli’ jest zamknięty na nowe odpowiedzi.