WordPress.org

Ready to get started?Download WordPress

Forums

Page Links To
Links with ampersands don't open in new window in the loop. (1 post)

  1. brobison
    Member
    Posted 2 years ago #

    The plugin works great for me until I try to use it inside the loop and the link has an ampersand in it. I noticed this first trying to open some links to YouTube in a new window.

    I spent some time troubleshooting this issue and narrowed it down an issue with the jQuery filter that adds the new window code. For some reason, the conversion to HTML entities was tripping up the filter.

    I'm not exactly sure how to fix the underlying issue, but I came up with a temporary workaround by using html_decode_entities() both in the plugin and my template:

    Plugin (line 291):
    Old Code:

    function id_to_url_callback( &$val, $key ) {
    		$val = get_permalink( $val );
    	}

    New Code:

    function id_to_url_callback( &$val, $key ) {
    		$val = html_entity_decode( get_permalink( $val ) );
    	}

    My Template:

    <h2 class="entry-title"><a href="<?php echo html_entity_decode( get_permalink() ); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'skeleton' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

    http://wordpress.org/extend/plugins/page-links-to/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic