Support

Account

Home Forums Feature Requests Ability to display fields groups on archive pages

Solving

Ability to display fields groups on archive pages

  • Sometimes we need to customize archive pages. In that case I usually use an options page and set 'parent' => 'edit.php?post_type=post_type_name' to show options page unde the custom post sub-menu.

    It’s a quite good solution, however, it would be wonderful if there was a possibility to assign custom fields groups directly to posts archive pages.

    Under the hood, it would still be an options page, but it would be registered automatically with 'posts_id' set to, lets’s say 'archive_post_type_name'

    I’m not sure about implementation details. How does it sound to you?

  • If there was a editor in WP for post archive pages (not terms) then I’m sure there would be the ability to add add field groups to these pages. You’re first step would be to convince WP to add an admin editor page for these archives. Until then where would these fields appear other than on an options page?

  • How is the existence of WP editor related to the ability of adding custom fields to the posts archives? I don’t get it. We’re able to register custom fields to custom options pages, user pages and widgets, etc. There’s no editor on these pages as well.

    Maybe my explanation in the first post wasn’t clear enough. I just want to show custom fields on archive pages, but store them the same way as options pages are stored at the moment. The only difference would not using the default ‘options’ string as an ID but some auto-generated id: for example acf-archive-{post_type_name}

    An options page for archive pages could be registered automatically if the custom field group that belongs to post archive is defined.

    Fields groups could be shown before or after the posts list table.

    The only thing I’m worried about is that I haven’t found yet a proper action to hook into (I mean the action that runs before and after the posts list table). Maybe there’s no hook for such things?

    The only hooks I found are all_admin_notices and in_admin_footer.

  • If I create an options page there is then a URL that I can go to in order to edit the fields attached to the options page. If I add fields to a category then I there is an admin URL that allows me to go and edit the fields that I’ve attached to it. There is no admin URL to edit the the main archive page. For example if I create a custom post type of “product” which has an archive template of ‘archive-product.php’ there is no corresponding admin URL to edit that archive page.

    I think that that having ACF automatically create an options page that is associated because you created fields attached to it is, well, completely reverse of what it does now. The locations that are available to select from are all real locations that exist before the fields are populated.

    As far as the hook, no, there is no such hook in WP for “before loop” and others. Something like that would be theme dependent, along the lines of this: https://github.com/zamoose/themehookalliance/blob/master/tha-theme-hooks.php

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

The topic ‘Ability to display fields groups on archive pages’ is closed to new replies.