Im currently using Redux plugin for WordPress with the slides "field": https://docsv3.redux.io/core/fields/slides/index.html .
The problem is i have 55+ slides.
I can get slide with index "0" this way:
if (isset($redux_demo['opt-slides']) && !empty($redux_demo['opt-slides'])) {
echo 'Slide 1 Title: ' . $redux_demo['opt-slides'][0]['title'];
echo 'Slide 1 URL: ' . $redux_demo['opt-slides'][0]['url'];
}
However i need to quickly get the slide with a specific title, like "homepage", the way im currently doing this is using PHP array_search() and go through every single slide in $redux_demo['opt-slides'] before it finds the one with the given name.
Isn't there a more optimized (performance wise) solution to this problem?, similar to:
$redux_demo['opt-slides']["homepage"]['url']
You could try the next code, a little function that needs 2 params your slides array The search term in Title (exact title, by now but you could change this behaviour with something not naive like a regex expression. Finally return the index of your slide.