Home › Forums › General Issues › Selection option used in header › Reply To: Selection option used in header
Sure, no problem! Ok, since we’re outside the loop, first you just want to grab the global query that is being passed to your template files and assign the post data to a variable.
Then you just add the post ID as a second parameter to get_field()
. Here’s what it should look like:
global $wp_query;
$post = $wp_query->post;
<?php if (get_field('options_posts', $post->ID) == "para_1") {
echo '<link rel="stylesheet" id="parallax-css" href="#" type="text/css" media="all" />' ;
} else if (get_field('options_posts', $post->ID) == "para_2") {
echo '<link rel="stylesheet" id="parallax2-css" href="#" type="text/css" media="all" />' ;
} ?>
That should take care of it for you, but if you have any trouble, let me know.
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.