• Resolved alexadark

    (@alexadark)


    Hi,
    i have a custom field i want on certains pages only, front page and another one, how i do that
    you give me the code for having it on front page with that ->show_on_page( (int) get_option( 'page_on_front'
    but i need it on another page, and don;t know how to do it
    this is my code for the moment

    Container::make( 'post_meta', 'Blockquote' )
             ->show_on_post_type( array( 'page', 'work' ) )
             ->show_on_page( (int) get_option( 'page_on_front' ) )
    • This topic was modified 8 years, 2 months ago by alexadark.
Viewing 1 replies (of 1 total)
  • Plugin Author htmlBurger

    (@htmlburger)

    Hi @alexadark,

    For your problem one approach is to make multiple containers, just keep in mind that the container names should be unique. Example:

    
    Container::make( 'post_meta', 'Home Blockquote' )
             ->show_on_page( (int) get_option( 'page_on_front' ) )
    
    Container::make( 'post_meta', 'Work Blockquote' )
             ->show_on_post_type( 'work' )
    
    Container::make( 'post_meta', 'About Blockquote' )
             ->show_on_template( 'templates/about.php' )
    

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom fields on certain pages only’ is closed to new replies.