PHP Help for WordPress Permalink Loop

I am trying to get all permalinks that have been created through a plugin to open in a new window. I know I need to edit the Index, Archive, and Search loops for links, however I keep getting an error when I try to have them open in a new window.

The loop function in index looks like:

Read More
            $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; ?>

Here it is in the Archives:

    <?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; ?>

And from Search:

    <?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; ?>

From the documentation I could find on the plugin it says this code needs to be inserted into the loop but when I avoid syntax errors I am still unable to get it to work properly:

    <?php if 
        (is_syndicated()): ?>target="_blank"<?php endif; 
        ?>><?php the_title(); ?>

Please advise as I have tried to updated code in multiple different places and have been unsuccessful.

Thanks,
CBux

Related posts

Leave a Reply