Support

Account

Home Forums Add-ons Options Page ACF Options Page for Post Type

Solved

ACF Options Page for Post Type

  • I would like to have an options page that is located inside the menu for a custom post type. Then all the fields for that options page can then be used as a static part of the CPT’s post page template.

    The menu would look like this:

    OFFERS
    — All Offers
    — New Offer
    — Categories
    — Offers Page Content

    Does that make sense?

    Thanks in advance!

    • James

    • September 8, 2016 at 1:23 pm

    Hi @robertrhu

    You should be able to do it like this:

    if( function_exists('acf_add_options_page') ) {
        
        acf_add_options_sub_page(array(
            'page_title'     => 'Offers Page Content',
            'menu_title'    => 'offers-page-content',
            'parent_slug'    => 'edit.php?post_type=offers',
        ));
    
    }

    Where ‘offers’ is the slug of your custom post type.

    I hope this helps 🙂

  • Thanks! Then I can just call the custom fields in the page template that the post type uses?

    • James

    • September 8, 2016 at 2:32 pm

    Hi @robertrhu

    I’m not sure I understand your query. Could you please explain it in more detail? If you can, could you please share some screenshots with notes on how you want to accomplish it?

    If you want to get the custom fields value on the options page, you need to pass option to the second parameter of the get_field() or the the_field() function. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/get-values-from-an-options-page/.

    Thanks 🙂

  • That did the trick! Thanks a ton for all your help James!

  • You can use a plugin ACF CPT Options Pages

Viewing 6 posts - 1 through 6 (of 6 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.