Support » Plugin: Carbon Fields » Carbon Fields only show on home page edit screen

  • Resolved stolentino



    I have created a bunch of containers and fields that I want only to display on the Home page edit screen of the site. I may also want to do additional pages later. I have seen the options for showing by post type, template and whatnot but those do not solve the issue. The issue I am currently dealing with is that I am using ->show_on_post_type(‘page’) (obviously it shows the fields on every page edit screen) but I have tried using something like ->show_on_page( (int) get_option( ‘page_on_front’ ) ) but I am assuming since this works by page ID, this information isn’t available yet while editing the page? I’m not sure. I would love some assistance on this as I also need to build something that creates an admin interface that allows options of what page/post/post type/template to show what containers on instead of hard coding it. Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Atanas Angelov


    Hi @stolentino,

    Using ->show_on_page( (int) get_option( 'page_on_front' ) ) should show the container only for the homepage (if you have a page assigned as the homepage of course).
    Alternatively, if you have a template assigned to the homepage you can also use ->show_on_template( 'template-name.php' ).

Viewing 1 replies (of 1 total)
  • The topic ‘Carbon Fields only show on home page edit screen’ is closed to new replies.