Home › Forums › Front-end Issues › Force 1st Accordion Open on Page Load › Reply To: Force 1st Accordion Open on Page Load
OK, Well, I think I solved my problem. The following code added to the functions file will force the first accordion open.
add_action('acf/input/admin_head', 'my_acf_input_admin_head');
function my_acf_input_admin_head() {
?>
<script type="text/javascript">
jQuery(function(){
jQuery('.acf-accordion').removeClass('-open');
jQuery('.acf-accordion:first-of-type').addClass('-open');
});
</script>
<?php
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.