0

我创建了一个网站,出于某种原因,我的自定义帖子类型portfolio.php 列出了我的自定义帖子类型中的所有帖子,它们都显示得很好。但是我的 single-portfolio.php 从我的自定义帖子类型的最新帖子中获取信息?但转到正确的链接。

            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>


                        <article class="span12" id="worktit"><h2>Client name: <?php echo get_post_meta(get_the_ID(), 'client', true); ?> </h2></article>
                        <h2>what it looks like...</h2>
                        <article id="workimg"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></article>

                    <ul class="span5 clientinfo" ><!-- connect start -->
                    <h3>Project info: </h3>
                        <li id="client">Client name: <?php echo get_post_meta(get_the_ID(), 'client', true); ?></li>            
                        <li id="link">Project url: <?php echo get_post_meta(get_the_ID(), 'link', true); ?></li>
                        <li id="year">Year produced: <?php echo get_post_meta(get_the_ID(), 'year', true); ?></li>
                        <li id="designer">Project Designer: <?php echo get_post_meta(get_the_ID(), 'designers', true); ?></li>
                        <li id="developer">Project Developer: <?php echo get_post_meta(get_the_ID(), 'developers', true); ?></li>

                    </ul><!-- connect end -->

                    <ul class="span5 skill" ><!-- skills start -->
                    <h3>Technologies used:</h3>
                    <?php $skill = get_the_term_list($post->ID, 'Skills','<li>', '</li><li>', '</li>'); echo strip_tags($skill, '<li></li>');?>
                    </ul> <!-- skills end -->


                    <section class="span12 devneed">
                        <h2>Need a developer for your next project?</h2>
                        <a href="<?php echo get_page_link(12); ?>">Get in touch</a>
                    </section>  

                        </article>

            <?php endwhile; // end of the loop. ?>      

                <?php endif; ?>

那是我的 single-portfolio.php

我的portfolio.php 是

                <?php 
                        $loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => -1, ) ); 
                    ?>
                    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>


                    <section id="portfolioWrap" class="span12">
                        <article class="span12" id="worktit"><h2><a href="<?php the_permalink(); ?>">Client name: <?php echo get_post_meta(get_the_ID(), 'client', true); ?> </h2></a></article>
                        <article  id="skillused">
                        <p>Skills used :
                        <?php $skillused = get_the_term_list($post->ID, 'Skills','<li>', ', ', '</li>'); echo strip_tags($skillused);?></p></article>           
                        <article id="workimg"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></article>
                        </article>
                    </section>

            <?php endwhile; ?>
4

1 回答 1

0

固定的。php问题是我在页面顶部有一个打开的标签。

于 2013-09-18T02:12:34.710 回答