Support

Account

Home Forums ACF PRO Adding a custom field to a custom post type list page in admin

Solved

Adding a custom field to a custom post type list page in admin

    • jags

    • May 5, 2020 at 4:47 am

    Hi,

    I have created a custom post type called Playlists using the “Custom Post Type UI” plugin.
    Using ACF Pro I was able to add custom fields to the “Playlist” post page.
    Now I want to add a custom field to the “Playlists” page in wp-admin (one where you see all the posts). URL: /wp-admin/edit.php?post_type=playlist (screenshot attached)

    The idea is to select top 5 playlist posts. I would prefer that it can be done on the “list” page of wp-admin.

    Thanks

  • Hey Jags,

    What you’re talking about is the customisation of the Posts list table. This is done via functions.php using the two following hooks:

    I actually saved a gist which provides a similar music based example.

    I hope this helps!

    Dan

    • jags

    • May 9, 2020 at 1:12 am

    Hey Dan,

    Your reply went to my spam! I used an alternate approach in meantime.
    But I was not trying to add columns to the table but rather add custom fields on the post list page itself.
    Is that doable with ACF?

    Thanks,
    Jags

  • That is what @morgyface was showing you. YOu need to add custom columns to the list page and then add the content for each post.

    • jags

    • May 9, 2020 at 2:10 am

    I think he is talking about displaying columns for custom field in a playlist whereas I need editable fields for the listing page.
    Maybe I have this pictured incorrectly (technically) in my head but see attached screenshot.

    Thanks

  • I’ve got a feeling @jags would like to assign custom fields to the Posts list page itself as its own entity and I’m pretty sure that’s not possible. However, I think what you could do is customise the in-built filter to achieve the same result.

    https://wordpress.stackexchange.com/questions/16637/how-to-filter-post-listing-in-wp-dashboard-posts-listing-using-a-custom-field/16641

  • Hey @jags, okay I think I know what you want to achieve, but I think you’ll need to apply the playlist position field to the playlist post itself. You could then customise the post lists screen to show the playlist position column and data for each post.

    I’m guessing you’re aiming for an end result of being able to edit the playlist position via the post lists page itself. This could be done, by exploring the customisation of “quick edit”, but it doesn’t look like an easy task.

    The other thing you could do, and this might be more straightforward, is use taxonomies. You could create a “position” taxonomy and then have terms for the position, you could have first, second, third and standard. It looks like Custom Post Type UI has a feature that allows you to add taxonomies to quick edit.

    • jags

    • May 9, 2020 at 2:56 am

    Thanks for detailed reply Dan.
    This is the 1st time I am using ACF and after googling for 1hr I kind of felt what I was trying to achieve does not exactly falls into standard behaviour.
    But ACF homepage said “Fields can be added all over WP” so I thought maybe I am missing something obvious. Glad to know that I wasn’t 🙂

    I will stick to custom field on the page for this.

  • There is an ACF quick edit plugin floating around somewhere, or at least there was at one time.

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

You must be logged in to reply to this topic.

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.