-1

私は自分のテーマpage.phpを次のように持っています:

<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
        <header class="entry-header">
               <div class="hd"><?php the_title(); ?></div>
            <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
                <div class="video"><?php the_post_thumbnail(); ?></div>
            <?php endif; ?>
            <div class="hd"><?php //the_title(); ?></div>
        </header><!-- .entry-header -->     
        <?php the_content(); ?>
        <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
        <!-- .entry-content -->
        <footer class="entry-meta">
            <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
        </footer><!-- .entry-meta -->
    </article><!-- #post -->
    <?php // comments_template( '', true ); ?>      
<?php endwhile; ?>

ワードプレスのブログ、画像、ニュースの 3 つのページを作成し、それぞれにカテゴリを割り当てました。今、私は php-exec プラグインをインストールしました。現在、ブログ データを取得するために、ページ エディターでいくつかの php コードを書いています...

それは正常に動作しますが、データを 2 回取得し、今は page.php のせいです。

したがって、コテゴリーごとにデータを取得しようとしている場合、page.php に何らかの条件を設定できますか? page.php データは表示されません...

これがブログページエディターに適用した私のコードです

<?php if (query_posts('cat=63&showposts=5')) : ?>
    <?php while (have_posts()) : the_post();
        // do whatever you want
    ?>
    <div class="gallery_views"> 
        <div class="hd"><?php the_title(); ?></div>
        <?php // get_template_part( 'content', get_post_format() ); ?>
        <?php // cup_post_nav(); ?>
        <?php the_post_thumbnail(); ?>
        <?php comments_template(); ?>
        <b><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></b>
    </div>
    <?php endwhile; ?>
<?php else : ?> 

前もって感謝します..

4

1 に答える 1