Wordpress:根据页面ID回声PHP


Wordpress: Echo PHP depending on page ID

下午好,我试图在模板中使用PHP显示帖子,但我使用相同的模板根据年龄ID输出不同的帖子。

我目前有这个代码,它工作。。。

<?php //GET MEMBERS ?>
                    <?php query_posts('category_name=members&orderby=date'); ?>
                    <div class="row-fluid">
                        <ul class="thumbnails">
                            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                            <li class="span4">
                                <div class="thumbnail">
                                    <?php // check if the post has a Post Thumbnail assigned to it.
                                    the_post_thumbnail();
                                    ?>
                                    <div class="pad">
                                        <h3><?php the_title(); ?></h3>
                                        <?php the_content(); ?>
                                    </div>
                                </div>
                            </li>
                            <?php endwhile; ?>
                        </ul>
                    </div>
                    <?php endif; ?>

但我需要根据页面ID输出不同的"类别"…E.G

如果页面id是7 echo"php脚本"否则页面id为13 echo"不同的php脚本"

谢谢Brad

Wordpress有一些内置函数。您可以使用get_the_ID()返回要在if语句中使用的ID号。

问候