Hello,
I was indeed using the block-layout. Changing this to “row” or “table” is not helping.
So to clarify it:
Field: repeater – table/row/block layout (doesn’t matter)
Repeater field: image – required
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;
}
At this time after editing a CPT post (which is not working) is giving me this values after printing $options:
array(4) {
'lang' =>
string(0) ""
'ajax' =>
bool(false)
'post_id' =>
string(2) "62"
'post_type' =>
string(8) "training"
}
Going to try to debug some things
Thanks John,
This helped out. Although my options still aren’t working.. I get this error message:
Undefined index: page_template
Location:
...actions.php on line 81
Underneath the two functions (the first one is also from my first post):
add_filter('acf/location/rule_values/page_template', 'add_themosis_templates_to_acf_rules', 20);
function add_themosis_templates_to_acf_rules($choices)
{
$key = 'theme';
$configFile = 'templates.config.php';
$configTemplates = include(themosis_path($key) . 'config' . DS . $configFile );
$templates = array();
foreach ($configTemplates as $configTemplate) {
$prettyTemplateName = str_replace(array('-', '_'), ' ', ucfirst(trim($configTemplate)));
$templates[$configTemplate] = $prettyTemplateName;
}
return array_merge(array('none' => __('None')), $templates);
}
// get themosis templates
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
$page_template = $options['page_template']; // This is line #81
// get page template
if (!$page_template && $options['post_id']) {
$page_template = get_post_meta($options['post_id'], '_themosisPageTemplate', true);
}
// 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.