hidden field per page template

Support General hidden field per page template

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7139
    LorenzoLorenzo
    Participant

    Hi, I'm triyng to hidden a field for a specific page template (page-home.php).
    I copied the code at this page (https://metabox.io/docs/meta-box-conditional-logic/) to try an example.
    I set: 'hidden' => array( 'page-template', 'page-home.php' ),
    But it doesn't work. I continue to see the field in every page. Maybe I don't know the precise syntax.
    Someone can help me? 🙂
    Thanks
    Loren

    #7140
    Truong GiangTruong Giang
    Participant

    Hi there,

    Where do you put page-home.php file?

    Thank you.

    #7148
    LorenzoLorenzo
    Participant

    Hi!
    page-home.php file is at the same level of page.php of my theme (/wp-content/themes/my-theme/page-home.php)
    In effect, my home page is taking automatically page-home.php as page template in the front-end.
    In the editor I tryied to get the current template as title of meta box:
    'title' => basename( get_page_template() ),
    but I get "page.php" despite I'm editing the home page with "Home page" (page-home.php) template set!
    Thank you,
    L

    #7153
    LorenzoLorenzo
    Participant

    Solved.
    I put the function in a wrong place of my function.php file.
    Thank you.
    L

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘hidden field per page template’ is closed to new replies.