Image Frame: Open page in a new tab of my browser

Closed
Travelo - Travel/Tour/Car Rental/Cruise Booking WordPress Theme Travelo - Travel/Tour/Car Rental/Cruise Booking WordPress Theme January 11, 2019
Login to reply
Guillermo Moschini
3 years ago
Resolved.
Guillermo Moschini commented privately
Kelly R Support Agent
3 years ago

Hi,

Please edit /inc/functions/shortcode/shortcodes.php file.

You can find following function.

function shortcode_imageframe( $atts, $content = null ) {

  $variables = array( 'src'=>'', 'link'=>'#', 'alt'=>'imageframe-image', 'title'=>'', 'hover' => '', 'class' => '', 'width' => '', 'height' => '', 'label' => '', 'label_content' => '', 'position' => '', 'animation_type'=>'', 'animation_duration'=>'', 'animation_delay'=>'' ); // hover values = (hover-effect|hover-effect yellow|opacity)

  extract( shortcode_atts( $variables, $atts ) );

                if ( empty( $hover ) ) {

   $hover = 'opacity';

  }

  //$class = empty( $class )?'':( ' class="' . esc_attr( $class ) . '"' );

  if ( empty( $hover ) || ( $hover == 'opacity' ) ) {

   $class .= " " . $hover;

  }

  $a_class = ' class="' . esc_attr( $class ) . '"';

  $label = empty( $label )?'':( '<h3 class="caption-title">' . esc_html( $label ) . '</h3>' );

  $label_content = empty( $label_content )?'':( '<span>' . esc_html( $label_content ) . '</span>' );

  $label_content = $label . $label_content;

  $width = empty( $width )?'':( ' width="' . esc_attr( $width ) . '"' );

  $height = empty( $height )?'':( ' height="' . esc_attr( $height ) . '"' );

  $img_class = '';

  $figure_class = ( $position != 'middle' )?'':( ' class="middle-block"' );

  $alt = empty( $alt )?'':' alt="' . esc_attr( $alt ) . '"';

  $animation = '';

  if ( ! empty( $animation_type ) ) {

   $img_class = ( $position != 'middle' )?' class="animated"':( ' class="middle-item animated"' );

   $animation .= ' data-animation-type="' . $animation_type . '" data-animation-duration="' . $animation_duration . '" data-animation-delay="' . $animation_delay . '" ';

  } else {

   $img_class = ( $position != 'middle' )?'':( ' class="middle-item"' );

  }

  $result = '';

  $result .= '<figure' . $figure_class . '>';

  if ( $link != "no" ) $result .= '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '"' . $a_class . '>';

  $result .= '<img src="' . esc_url( $src ) . '"' . $alt . $width . $height . $img_class . $animation . ' />';

  $result .= do_shortcode( $content );

  if ( $hover == 'opacity' ) $result .= '<span class="opacity-wrapper"></span>';

  if ( $link != "no" ) $result .= '</a>';

  if ( ! empty( $label_content ) ) $result .= '<figcaption>' . $label_content . '</figcaption>';

  $result .= '</figure>';

  return $result;

 }

And replace with following.

function shortcode_imageframe( $atts, $content = null ) {

  $variables = array( 'src'=>'', 'link'=>'#', 'alt'=>'imageframe-image', 'title'=>'', 'hover' => '', 'class' => '', 'width' => '', 'height' => '', 'label' => '', 'label_content' => '', 'position' => '', 'animation_type'=>'', 'animation_duration'=>'', 'animation_delay'=>'' ); // hover values = (hover-effect|hover-effect yellow|opacity)

  extract( shortcode_atts( $variables, $atts ) );

                if ( empty( $hover ) ) {

   $hover = 'opacity';

  }

  //$class = empty( $class )?'':( ' class="' . esc_attr( $class ) . '"' );

  if ( empty( $hover ) || ( $hover == 'opacity' ) ) {

   $class .= " " . $hover;

  }

  $a_class = ' class="' . esc_attr( $class ) . '"';

  $label = empty( $label )?'':( '<h3 class="caption-title">' . esc_html( $label ) . '</h3>' );

  $label_content = empty( $label_content )?'':( '<span>' . esc_html( $label_content ) . '</span>' );

  $label_content = $label . $label_content;

  $width = empty( $width )?'':( ' width="' . esc_attr( $width ) . '"' );

  $height = empty( $height )?'':( ' height="' . esc_attr( $height ) . '"' );

  $img_class = '';

  $figure_class = ( $position != 'middle' )?'':( ' class="middle-block"' );

  $alt = empty( $alt )?'':' alt="' . esc_attr( $alt ) . '"';

  $animation = '';

  if ( ! empty( $animation_type ) ) {

   $img_class = ( $position != 'middle' )?' class="animated"':( ' class="middle-item animated"' );

   $animation .= ' data-animation-type="' . $animation_type . '" data-animation-duration="' . $animation_duration . '" data-animation-delay="' . $animation_delay . '" ';

  } else {

   $img_class = ( $position != 'middle' )?'':( ' class="middle-item"' );

  }

  $result = '';

  $result .= '<figure' . $figure_class . '>';

  if ( $link != "no" ) $result .= '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '"' . $a_class . ' target="_blank">';

  $result .= '<img src="' . esc_url( $src ) . '"' . $alt . $width . $height . $img_class . $animation . ' />';

  $result .= do_shortcode( $content );

  if ( $hover == 'opacity' ) $result .= '<span class="opacity-wrapper"></span>';

  if ( $link != "no" ) $result .= '</a>';

  if ( ! empty( $label_content ) ) $result .= '<figcaption>' . $label_content . '</figcaption>';

  $result .= '</figure>';

  return $result;

 }


Regards, C-Themes


Guillermo Moschini
3 years ago

Hi,

I'm using the 'Image Frame' element. Can I open the link that I put in the 'Link' field, in a new browser tab?

Thank you!!

Regards