Answer the question
In order to leave comments, you need to log in
Redux slides (how to make them dynamic)?
Good day!
I'm pulling a template on wordpress (I'm doing it for the first time) as the framework chose Redux.
There was a problem when adding a slider, the fact is that the slider has several photos, and when adding a function from the framework, only one photo is shown, html is not duplicated to display all loaded slides in redux.
Function code:
'title' => __( 'Slides', 'redux-framework-demo' ),
'id' => 'additional-slides',
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="//docs.reduxframework.com/core/fields/slides/" target="_blank">docs.reduxframework.com/core/fields/slides/</a>',
'subsection' => true,
'fields' => array(
array(
'id' => 'opt-slides',
'type' => 'slides',
'title' => __( 'Slides Options', 'redux-framework-demo' ),
'subtitle' => __( 'Unlimited slides with drag and drop sortings.', 'redux-framework-demo' ),
'desc' => __( 'This field will store all slides values into a multidimensional array to use into a foreach loop.', 'redux-framework-demo' ),
'placeholder' => array(
'title' => __( 'This is a title', 'redux-framework-demo' ),
'description' => __( 'Description Here', 'redux-framework-demo' ),
'url' => __( 'Give us a link!', 'redux-framework-demo' ),
),
),
)
) );
<div class="sider_container">
<div class="slide_item">
<img src="<?php if (isset($brainiak['opt-slides']) && !empty($brainiak['opt-slides'])) { echo $brainiak['opt-slides'][0]['image'];}?>" alt="<?php echo $brainiak['opt-slides'][0]['title']; ?>" class="img-responsive"></div>
</div>
<div class="slide_item">
<img src="" alt="" class="img-responsive"></div>
<div class="sider_container"> </div>
Answer the question
In order to leave comments, you need to log in
First, you need to understand what you are doing, in what form the data is returned to you, and how to process it.
<div class="sider_container">
<div class="slide_item">
<?php if( ! empty( $brainiak['opt-slides'] ) ) {
foreach ( $brainiak['opt-slides'] as $val )
echo '<img src="' . $val['image']. '" alt="' . $val['title'] .'" class="img-responsive">';
} ?>
</div>
</div>
printf('<img src="%s" alt="%s" class="img-responsive">', $val['image'], $val['title']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question