Wordpress循环,echo post值?

时间:2013-01-11 22:32:35

标签: php wordpress

我有当前的循环工作来显示帖子,但我似乎无法获得要填充的标题或内容。我错过了什么?

                <?php
        // LOOP ARGUMENTS
        $args = array( 'post_type' => 'cbd_slider', 'posts_per_page' => -1 ); // -1 Shows ALL Posts
        $loop = new WP_Query( $args );
        while ( $loop->have_posts() ) : $loop->the_post();

        // CUSTOM CONTENT
        $slideLink = get_post_meta($post->ID,"slideLink",true);
        $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name');
        $imgURL = (isset($thumb[0]) ? $thumb[0] : get_template_directory_uri() . "/images/placeholder.jpg");
        ?>


        <li class="clearfix"><!-- Start of featured slide -->
              <a href="<?php echo $slideLink ?>">
                    <img src='<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo urlencode($imgURL); ?>&h=330&w=496' alt='featuredimage'  /></a>

              <div class="description">
                    <h2>TITLE GOES HERE</h2>
                    <p>POST CONTENT GOES HERE</p>
                    <a href="<?php echo $slideLink ?>" class="more"> more </a>
              </div>
        </li><!-- End of featured slide --><?php /* END WHILE AND RESET QUERY */ endwhile; wp_reset_query(); ?>

1 个答案:

答案 0 :(得分:1)

你试过the_title吗?将<?php the_title(); ?>替换为TITLE GOES HERE,将<?php the_content(); ?>替换为CONENT GOES HERE