Friday, July 12, 2013

[Help Wordpress] Custom variable for link target not working


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

Search

Other post

LizStrano on "[Plugin: WP Forum Server] Help with Search. Images showing up multiple times."[WP issuses]
LizStrano on "[Plugin: WP Forum Server] Help with Search. Images showing up multiple times."
Help with Search. Images showing up multiple times. - WordPresswordpress.org/.../help-with...
rene springmann on "[Plugin: WP Forum Server] New Posts in Topic not marked at Icon"[WP issuses]
rene springmann on "[Plugin: WP Forum Server] New Posts in Topic not marked at Icon"
WordPress ? Support ? New Posts in Topic not marked at Iconwordpress.org/support/topic/new...
elenamarieatsea on "Problems changing web address"[Wordpress issuses]
elenamarieatsea on "Problems changing web address"
rachelebaker on "This account is locked. Please contact Customer Support."[Wordpress issuses]
rachelebaker on "This account is locked. Please contact Customer Support."
This account is locked. Please contact Customer Support ...en.forums.wordpress.com/.../thi...
caveen on "How can you link a post in the blog feed to a page?"[Wordpress issuses]
caveen on "How can you link a post in the blog feed to a page?"
How can you link a post in the blog feed to a page? ? WordPress ...en.forums.wordpress.com...