Custom Fields
Re-Envisioned
Support General hidden field per page template

  • Creator
    Topic
  • #7139
    Lorenzo
    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #7140
    Truong Giang
    Participant

    Hi there,

    Where do you put page-home.php file?

    Thank you.

    #7148
    Lorenzo
    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
    Lorenzo
    Participant

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

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