Wordpress Permalink循环的PHP帮助
我试图让所有通过插件创建的永久链接在新窗口中打开。我知道我需要编辑链接的索引、存档和搜索循环,但是当我试图在新窗口中打开它们时,我总是会出错 索引中的循环函数如下所示:Wordpress Permalink循环的PHP帮助,php,wordpress,loops,permalinks,Php,Wordpress,Loops,Permalinks,我试图让所有通过插件创建的永久链接在新窗口中打开。我知道我需要编辑链接的索引、存档和搜索循环,但是当我试图在新窗口中打开它们时,我总是会出错 索引中的循环函数如下所示: $point_full_posts = get_theme_mod('point_full_posts'); $j=0; $i =0; while ( have_posts() ) : the_post(); ?> <article
$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; ?>
$point_full_posts=get_theme_mod('point_full_posts');
$j=0$i=0;while(have_posts()):the_post();?>
$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; ?>
在档案中:
$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; ?>
从搜索:
$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 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; ?>
从我在插件上找到的文档中可以看出,该代码需要插入到循环中,但当我避免语法错误时,我仍然无法使其正常工作:
$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 if
(is_syndicated()): ?>target="_blank"<?php endif;
?>><?php the_title(); ?>
target=“\u blank”>
请告知,因为我已尝试在多个不同的地方更新代码,但均未成功
谢谢,
CBux