Custom variable for link target not working
Hi,
I'm trying to add a custom variable for my images. It's the link target (_blank, etc...) when users enter a link in the slide.
This code is present in my functions.php :
class MyRoyalSliderRendererHelper {
private $post;
private $options;
function __construct( $data, $options ) {
$this->post = $data;
$this->options = $options;
}
function link_target() {
return $data->link_target;
}
}
function newrs_add_custom_variables($m, $data, $options) {
$helper = new MyRoyalSliderRendererHelper($data, $options);
print_r( $data );
$m->addHelper('link_target', array($helper, 'link_target') );
}]
add_filter('new_rs_slides_renderer_helper', 'newrs_add_custom_variables', 10, 4);
I added this code to NewRoyalSliderGallery.php :
$out .= NewRoyalSliderOptions::get_field_html( array(
'name' => 'link_target',
'label' => __( 'Link Target', 'new_royalslider' ),
'desc' => __( 'Target of the link (_blank = new page)', 'new_royalslider' ),
'type' => 'text',
'default' => isset($slide_data['link_target']) ? $slide_data['link_target'] : ''
),'slides' );
And of course, I added {{link_target}} to the slide markup.
And... it's not working... even the print_r is not displaying on the page!
What am I doing wrong?
Read more
help.dimsemenov.com
No comments:
Post a Comment