Title: [Plugin: Sponsors Carousel] Patch to add new functionality
Last modified: August 20, 2016

---

# [Plugin: Sponsors Carousel] Patch to add new functionality

 *  [elija](https://wordpress.org/support/users/elija/)
 * (@elija)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-sponsors-carousel-patch-to-add-new-functionality/)
 * I have been unable to find a way of contacting the author so am posting my patch
   to add the ability to open sponsor links in a new window here.
 * Hoping the author sees these posts 🙂
 *     ```
       --- /home/elija/Programming/php/prime/wp-content/plugins/copy of sponsors-carousel/sponsors-carousel.php
       +++ /home/elija/Programming/php/prime/wp-content/plugins/sponsors-carousel/sponsors-carousel.php
       @@ -48,6 +48,10 @@
        add_option("scwp_scroll_amount", "2", "", "yes");
        add_option("scwp_default_link", "", "", "yes");
        add_option("scwp_list", "", "", "yes");
       +
       +//  New option for opening links in new window / tab
       +//	Default new
       +add_option("scwp_link_target", "new");
   
        /*****************************
        * Enqueue jQuery & Scripts
       @@ -103,7 +107,12 @@
        //		wp_get_attachment_link($id, $size, true);
        		if (get_post($id)->post_excerpt <> '')$link = get_post($id)->post_excerpt;
        		else $link = get_option('scwp_default_link');
       -		$output .= "<li><a id=\"item".$i. "\" href=\"".$link."\" class=\"jcarousel-item\">";
       +		//  Relay link building code to include target
       +		$output .= "<li><a ";
       +		if ('new' == get_option('scwp_link_target')) {
       +			$output .= 'target="_blank"';
       +		}
       +		$output .= " id=\"item".$i. "\" href=\"".$link."\" class=\"jcarousel-item\">";
        		if (get_option('scwp_show_titles')=='true') $output .= wp_get_attachment_image( $id,$thumb_size );
        		else $output .= wp_get_attachment_image( $id,$thumb_size, false, array(title=>"") );
        		$output .= "</a></li>\n";
       @@ -197,6 +206,10 @@
   
        		$scwp_default_link = $_POST["scwp_default_link"];
        		update_option("scwp_default_link", $scwp_default_link);
       +
       +		//  Save link target
       +		$scwp_link_target = $_POST["scwp_link_target"];
       +		update_option("scwp_link_target", $scwp_link_target);
   
        		$scwp_link_image = $_POST["scwp_link_image"];
        		if ($scwp_link_image > "")
       @@ -303,6 +316,16 @@
        					<input type="text" size="10" name="scwp_scroll_amount" id="scwp_scroll_amount" value="<?php echo stripslashes(get_option('scwp_scroll_amount')) ?>" />
        					<a title="<?php _e("How many items should the carousel scroll", 'sponsors-carousel') ?>" />?</a>
        					</p>
       +		    <?php
       +			//  Output new option field for link target
       +		    ?>
       +                    <p><?php _e("Link target:", 'sponsors-carousel'); ?>
       +					<select type="select" name="scwp_link_target" id="scwp_link_target">
       +						<option value="new" <?php if ('new' == stripslashes(get_option('scwp_link_target'))) {  echo 'selected="selected"'; }?>>New Window or tab</option>
       +						<option value="" <?php if ('' == stripslashes(get_option('scwp_link_target'))) {  echo 'selected="selected"'; }?>>Same Window or tab</option>
       +					</select>
       +					<a title="<?php _e("Choose whether the links should open in the current window.", 'sponsors-carousel') ?>" />?</a>
       +					</p>
                             <p><?php _e("Default link:", 'sponsors-carousel'); ?>
        					<input type="text" size="50" name="scwp_default_link" id="scwp_default_link" value="<?php echo stripslashes(get_option('scwp_default_link')) ?>" />
        					<a title="<?php _e("Link to sponsors page. You can add custom link in image caption.", 'sponsors-carousel') ?>" />?</a>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Sergey Panasenko](https://wordpress.org/support/users/nitay/)
 * (@nitay)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sponsors-carousel-patch-to-add-new-functionality/#post-2618898)
 * Thanks,add.
 *  [curtismulder72](https://wordpress.org/support/users/curtismulder72/)
 * (@curtismulder72)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sponsors-carousel-patch-to-add-new-functionality/#post-2618913)
 * Elija or Sergey – would either of you happen to know whey the Sponsors Carousel
   is only displaying vertically? It doesn’t look like the screenshot at all. And
   it doesn’t scroll.
 * I’m using wp 3.3.1.
 * Thanks. Any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Sponsors Carousel] Patch to add new functionality’ is closed
to new replies.

## Tags

 * [new-window](https://wordpress.org/support/topic-tag/new-window/)

 * 2 replies
 * 3 participants
 * Last reply from: [curtismulder72](https://wordpress.org/support/users/curtismulder72/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-sponsors-carousel-patch-to-add-new-functionality/#post-2618913)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
