Created
June 23, 2013 08:02
-
-
Save facelordgists/5844238 to your computer and use it in GitHub Desktop.
Royal Slider Custom Variable Array.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class MyRoyalSliderRendererHelper { | |
private $post; | |
private $options; | |
function __construct( $data, $options ) { | |
$this->post = $data; | |
$this->options = $options; | |
} | |
function array_test() { | |
$var = array( | |
'foo' => array( | |
'bar' => array( | |
'baz' => 'qux', | |
), | |
), | |
); | |
return $var; | |
} | |
} | |
function newrs_add_custom_variables($m, $data, $options) { | |
$helper = new MyRoyalSliderRendererHelper($data, $options); | |
$m->addHelper('array_test', array($helper, 'array_test') ); | |
} | |
add_filter('new_rs_slides_renderer_helper', 'newrs_add_custom_variables', 10, 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="rsContent"> | |
<p>{{array_test.foo.bar.baz}}</p> | |
<p>{{#array_test}}{{#foo}}{{#bar}}{{baz}}{{/bar}}{{/foo}}{{/array_test}}</p> | |
<p>{{#array_test}}{{foo.bar.baz}}{{/array_test}}</p> | |
<p>{{#array_test}}{{array_test.foo.bar.baz}}{{/array_test}}</p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment