0

Wordpress の初心者として、私は現在、ネット上のリンクに基づいてテンプレートをまとめています。このテンプレートでは、すべてのブログ投稿がカテゴリ別にグループ化された 1 つのページに表示されます。残念ながら、定義リストをどのようにいじっても、 、フォーマットが機能していないようです。

次のコードが私の DL に応答しない理由がわかる人はいますか? 実際のページへのリンクはhttp://gameservertutorials.com/?page_id=2です

<?php
/*
Template Name: Group Archives
*/
?>

<?php get_header(); ?>

<div id="content">

    <?php

        $cat_args = array(
          'orderby' => 'name',
          'order' => 'ASC',
          'child_of' => 0
        );

        $categories =   get_categories($cat_args); 

    ?>

    <div class="post">

    <dl>
        <?php foreach($categories as $category){ ?>

                <div class="title">
                        <dt><h2><a href="<?php echo get_category_link( $category->term_id ) ?>" title="<?php echo sprintf( __( "View all posts in %s" ), $category->name ) ?>"><?php echo $category->cat_name ?></a></h2></dt>
                </div>

                <?php
                    $post_args = array(
                        'numberposts' => 50,
                        'category' => $category->term_id
                    );

                    $posts = get_posts($post_args);

                    foreach($posts as $post){
                ?>

                <dd><a href="<?php echo the_permalink(); ?>" title="<?php echo the_title(); ?>"><?php echo the_title(); ?></a></dd>

                    <?php
                    }
                    ?>

        <?php
        }
        ?>
    </dl>

    </div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>
4

1 に答える 1

0

<dt>タグから周囲の DIV を削除してみてください。

 <dt class="title"><h2><a href="<?php echo get_category_link( $category->term_id ) ?>" title="<?php echo sprintf( __( "View all posts in %s" ), $category->name ) ?>"><?php echo $category->cat_name ?></a></h2></dt>
于 2012-05-12T20:48:49.693 に答える