0

i have created with Advanced Custom Fields a true or false option.With this I want to give the web the option that the header tag get the stycky id only if the option is true. I have implemented what I thought was right, but I am not seeing what the mistake I have made.

$sticky = get_field('menu-sticky');

<header <?php if ($sticky): echo 'id="sticky"'; endif; ?>>

</header>

I'm starting on this and learning PHP self-taught, so I ask for understanding if the code I have built is wrong. I hope someone can help me. Thanks and best regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.