Home › Forums › Backend Issues (wp-admin) › Can't load templates in ACF (with Themosis) › Reply To: Can't load templates in ACF (with Themosis)
Thanks for the answer. I checked if the options are available:
add_filter('acf/location/rule_match/page_template', 'get_themosis_templates_from_acf_rules', 11, 3);
function get_themosis_templates_from_acf_rules($match, $rule, $options)
{
// vars
if (isset($options['page_template'])) {
$page_template = $options['page_template'];
}
// get page template
if (!isset($options['page_template']) && isset($options['post_id'])) {
$page_template = get_post_meta($options['post_id'], '_themosisPageTemplate', true);
}
if (isset($page_template)) {
// compare
if ($rule['operator'] == "==") {
$match = ($page_template === $rule['value']);
} elseif ($rule['operator'] == "!=") {
$match = ($page_template !== $rule['value']);
}
}
// return
return $match;
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.