我正在尝试通过插件创建的所有永久链接在新窗口中打开。我知道我需要为链接编辑索引,存档和搜索循环,但是当我尝试在新窗口中打开它时,我一直收到错误。
索引中的循环函数如下所示:
$point_full_posts = get_theme_mod('point_full_posts');
$j=0; $i =0; while ( have_posts() ) : the_post(); ?>
<article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">
<?php if ( empty($point_full_posts) ) : ?>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail" >
<?php echo '<div class="featured-thumbnail">'; the_post_thumbnail('featured',array('title' => '')); echo '</div>'; ?>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } else { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
<div class="featured-thumbnail">
<img src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
</div>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } ?>
<?php endif; ?>
这是档案馆:
<?php while ( have_posts() ) : the_post(); ?>
<article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">
<?php if ( empty($point_full_posts) ) : ?>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
<?php echo '<div class="featured-thumbnail">'; the_post_thumbnail('featured',array('title' => '')); echo '</div>'; ?>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } else { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
<div class="featured-thumbnail">
<img src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
</div>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } ?>
<?php endif; ?>
来自搜索:
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">
<?php if ( empty($point_full_posts) ) : ?>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
<?php echo '<div class="featured-thumbnail">'; the_post_thumbnail('featured',array('title' => '')); echo '</div>'; ?>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } else { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
<div class="featured-thumbnail">
<img src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
</div>
<div class="featured-cat"><?php $category = get_the_category(); echo $category[0]->cat_name; ?></div>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</a>
<?php } ?>
<?php endif; ?>
从我在插件上找到的文档中,它说这个代码需要插入到循环中,但是当我避免语法错误时,我仍然无法使其正常工作:
<?php if
(is_syndicated()): ?>target="_blank"<?php endif;
?>><?php the_title(); ?>
请告知我,我已尝试在多个不同的地方更新代码并且未成功。
谢谢, CBux