Hi
You can add a class to the container pretty easily. Just add this to functions.php:
add_filter('metaslider_css_classes', 'add_metaslider_classes', 20, 3);
function add_metaslider_classes($classes, $slider_id, $slider_settings) {
if (some logic that you check) {
$classes .= ' has-right-caption';
}
return $classes;
}
Additionally, we have an upgrade option if you need custom themes where you can set the caption position as well.
Let me know if you have any questions.
Thank for the quick response, what I need is on a slide by slide basis:
In looking at the code I think what I need is the
metaslider_nivo_slider_image_attributes filter
$attributes[‘class’]
but in order to really get what I am looking for I would need to add an input field into the individual slide tabs. So:
metaslider_image_slide_tabs
can add a tab (and field)
then how do I retrieve the value from my new tab to plug into
metaslider_nivo_slider_image_attributes
am I getting warm?
thx,
John
Hi @johnnya23,
There’s not really an easy way for me to write it out here. You could look through the schedule slides basic add-on to see how to add a tab and save the data. That might be the best approach. Just add a simple checkbox, then check for its status in which ever hook you decide to use.
https://ww.wp.xz.cn/plugins/meta-slider-schedule-slides/
One good way to check for validity of a checkbox is:
filter_var($checkbox, FILTER_VALIDATE_BOOLEAN) which will check for various “truthy” values
Let me know how it goes.
got it working. Used this to save:
function jma_int_meta_save_settings($slide_id, $slider_id, $fields)
{
/*used the same select format as image crop*/
update_post_meta($slide_id, '_meta_slider_jma_caption_position', $fields['jma_caption_position']);
update_post_meta($slide_id, '_meta_slider_jma_class', $fields['jma_class']);
}
add_action('metaslider_save_image_slide', 'jma_int_meta_save_settings', 10, 3);
then get_post_meta within function on metaslider_nivo_slider_image_attributes filter
and it was actually the $attributes[‘data-caption’] value
Looks good, and thanks for the follow up! Let me know if you have any more questions (comment here or open a new issue). I’ll mark this resolved.
By the way, if you’re enjoying MetaSlider please leave us a 5-star review. They really help us out and let others find our plugin more easily. If you don’t think we deserve the 5 stars please let us know how we can improve, too. Thanks!
https://ww.wp.xz.cn/support/plugin/ml-slider/reviews#new-post