Support

Account

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;
    }