wordpress模板中的多个循环打破永久链接

时间:2014-05-14 13:09:05

标签: php wordpress loops custom-post-type

我一直在使用从其中一个wordpress主题市场购买的模板,并且我已经为这个特定的模板文件添加了第二个循环,以便从"页面"中提取内容。自定义帖子类型"投资组合"显示帖子。

投资组合帖子类型显示图像,链接标题,摘录和"阅读更多"链接。链接在代码中呈现但无法单击,我无法理解为什么会发生这种情况。任何见解将不胜感激。

这是该页面的代码:

<?php
/**
 * Template Name: Page No Top Text
 */

get_header(); ?>
<!-- #content -->
<div class="container_12 primary_content_wrap clearfix">
  <div id="content" class="grid_12">
      <?php include_once (TEMPLATEPATH . '/title.php');?>
   <?php global $more;  $more = 0;?>
   <?php $values = get_post_custom_values("category-include"); $cat=$values[0];  ?>
   <?php $catinclude = 'portfolio_category='. $cat ;?>

   <?php $temp = $wp_query;
   $wp_query= null;
   $wp_query = new WP_Query(); ?>
   <?php $wp_query->query("post_type=portfolio&". $catinclude ."&paged=".$paged.'&showposts=99'.'&orderby=date&order=asc'); ?>
   <?php if ( ! have_posts() ) : ?>
   <div id="post-0" class="post error404 not-found">
    <h1 class="entry-title"><?php _e( 'Not Found', 'theme1577' ); ?></h1>
    <div class="entry-content">
     <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'theme1577' ); ?></p>
     <?php get_search_form(); ?>
   </div><!-- .entry-content -->
 </div><!-- #post-0 -->
<?php endif; ?>
<div id="gallery" class="one_column">
  <ul class="portfolio">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <?php
    $custom = get_post_custom($post->ID);
    $lightbox = $custom["lightbox-url"][0];
    ?>

    <li>
      <div class="clearfix">
       <?php if($lightbox!=""){ ?>
       <a class="image-wrap" href="<?php echo $lightbox;?>" data-gal="prettyPhoto[gallery]" title="<?php the_title();?>"><?php the_post_thumbnail( 'portfolio-post-thumbnail-xl' ); ?><span class="zoom-icon"></span></a>
       <?php }else{ ?>
       <a class="image-wrap" href="<?php the_permalink() ?>" title="<?php _e('Permanent Link to', 'theme1577');?> <?php the_title_attribute(); ?>" ><?php the_post_thumbnail( 'portfolio-post-thumbnail-xl' ); ?></a>
       <?php } ?>
       <div class="folio-desc">
        <h3><a href="<?php the_permalink(); ?>"><?php echo the_title('','',FALSE);?></a></h3>
        <p class="excerpt">
              <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,55);
              //the_content();?>
            </p>
            <a href="<?php the_permalink() ?>" class="button"><?php _e('Read more', 'theme1577'); ?></a>
          </div>
        </div>
      </li>

    <?php endwhile; ?>

  </ul>

  <br>

  <div class="clear"></div>
</div>

<?php if(function_exists('wp_pagenavi')) : ?>
    <?php wp_pagenavi(); ?>
<?php else : ?>
  <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  <nav class="oldernewer">
    <div class="older">
      <?php next_posts_link( __('&laquo; Older Entries', 'theme1577')) ?>
    </div><!--.older-->
    <div class="newer">
      <?php previous_posts_link(__('Newer Entries &raquo;', 'theme1577')) ?>
    </div><!--.newer-->
  </nav><!--.oldernewer-->
<?php endif; ?>
<?php endif; ?>
<!-- Page navigation -->

<?php $wp_query = null; wp_reset_query(); wp_reset_postdata(); $wp_query = $temp;  ?>
</div>
<!-- #content -->
<div class="container_12 fullWidthContent clearfix">
  <div class="grid_12">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); the_content(); endwhile;  ?>
  </div>
</div>
<!-- end #main -->
</div>
<?php get_footer(); ?>

0 个答案:

没有答案