Home Forums General Issues Location Rules – Category Page Template


Location Rules – Category Page Template

  • I want different ACF Field Groups to show in the editor for different Category Page Templates, but I haven’t been able get this to work. It is the same concept as using the already defined Page Template, but for Category Pages.

    Any help would be greatly appreciated.

  • I’m assuming that you’re using a plugin that let’s you assign templates to categories. You would need to build a custom location rule if this is the case.

  • I have looked through the explanation, but it isn’t clear where the example code is supposed to be added.

    Which file is this code being added to?

    add_filter('acf/location/rule_types', 'acf_location_rules_types');
    function acf_location_rules_types( $choices )
        $choices['Basic']['user'] = 'User';
        return $choices;
  • Ok, looks like I found where it goes:

  • No, do not edit the ACF files.

    You need to add the code you your functions.php file.

    I’m going to be honest though. After giving this some thought I’m not sure it will work 100%. I don’t know what plugin you’re using for templates but its safe to say that it doesn’t use a standard wp field of any kind. This means that the field groups will not change automatically when you change templates. You would need to change the template and save the category to have them change.

  • No, still don’t see how it goes in that file.

    The example really isn’t very clear at all as to where the different pieces of code are supposed to go.

  • Ok, thanks for your help.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Location Rules – Category Page Template’ is closed to new replies.