{"action":"created","issue":{"url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/461","repository_url":"https://api.github.com/repos/WebDevStudios/CMB2","labels_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/461/labels{/name}","comments_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/461/comments","events_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/461/events","html_url":"https://github.com/WebDevStudios/CMB2/issues/461","id":106721783,"number":461,"title":"show_on filter for page template front-page.php doesn't work","user":{"login":"benoitchantre","id":1521015,"avatar_url":"https://avatars.githubusercontent.com/u/1521015?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitchantre","html_url":"https://github.com/benoitchantre","followers_url":"https://api.github.com/users/benoitchantre/followers","following_url":"https://api.github.com/users/benoitchantre/following{/other_user}","gists_url":"https://api.github.com/users/benoitchantre/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitchantre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitchantre/subscriptions","organizations_url":"https://api.github.com/users/benoitchantre/orgs","repos_url":"https://api.github.com/users/benoitchantre/repos","events_url":"https://api.github.com/users/benoitchantre/events{/privacy}","received_events_url":"https://api.github.com/users/benoitchantre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-09-16T08:12:43Z","updated_at":"2016-09-13T17:36:21Z","closed_at":null,"body":"Hello,\r\n\r\nI would like to display a custom metabox for the the front page only (in the admin), but it doesn't work.\r\nWhen I remove the line below, the metabox is show, but on all pages.\r\n`'show_on'                 => array( 'key' => 'page-template', 'value' => 'front-page.php' ),`\r\n\r\nHere's my code in function.php\r\n```\r\nadd_action( 'cmb2_init', 'cmb_for_front_page' );\r\nfunction cmb_for_front_page() {\r\n    // Start with an underscore to hide fields from custom fields list\r\n    $prefix = '_cmb_front_page_';\r\n    $_cmb_front_page_ = new_cmb2_box( array(\r\n        'id'                      => $prefix . 'metabox',\r\n        'title'                   => __( 'Additional informations', 'quaero-team' ),\r\n        'object_types'            => array( 'page' ), // Post type\r\n        'show_on'                 => array( 'key' => 'page-template', 'value' => 'front-page.php' ),\r\n        'context'                 => 'normal',\r\n        'priority'                => 'high',\r\n        'show_names'              => true // Show field names on the left\r\n    ) );\r\n    $_cmb_front_page_->add_field( array(\r\n        'name'                    => 'test',\r\n        'id'                      => $prefix . 'test',\r\n        'type'                    => 'text',\r\n    ));\r\n}\r\n```\r\n\r\nIs it supposed to work like I tried?\r\n\r\nThanks for your help.\r\n\r\n---\r\n\r\n__Update:__\r\nI try to make it work in a multilingual website that use Polylang,\r\nThe solution below works, but only for the page that was selected in the reading settings.\r\nThe custom metabox doesn't display in the translated page.\r\nhttps://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-show_on-filters#example-front-page-show_on-filter"},"comment":{"url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/comments/246760933","html_url":"https://github.com/WebDevStudios/CMB2/issues/461#issuecomment-246760933","issue_url":"https://api.github.com/repos/WebDevStudios/CMB2/issues/461","id":246760933,"user":{"login":"atrivisano","id":5932231,"avatar_url":"https://avatars.githubusercontent.com/u/5932231?v=3","gravatar_id":"","url":"https://api.github.com/users/atrivisano","html_url":"https://github.com/atrivisano","followers_url":"https://api.github.com/users/atrivisano/followers","following_url":"https://api.github.com/users/atrivisano/following{/other_user}","gists_url":"https://api.github.com/users/atrivisano/gists{/gist_id}","starred_url":"https://api.github.com/users/atrivisano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atrivisano/subscriptions","organizations_url":"https://api.github.com/users/atrivisano/orgs","repos_url":"https://api.github.com/users/atrivisano/repos","events_url":"https://api.github.com/users/atrivisano/events{/privacy}","received_events_url":"https://api.github.com/users/atrivisano/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T17:36:21Z","updated_at":"2016-09-13T17:36:21Z","body":"Hey there, I know this is kind of grave digging but if someone comes across this looking for answers, I had the same problem `'show_on' => array( 'key' => 'page-template', 'value' => 'front-page.php' )`  wasn't showing then I decided to try `'show_on' => array( 'key' => 'page-template', 'value' => 'template_dir/front-page.php' )` and it worked.\r\n\r\nBasically if you are organising your template files in a directory you have to specify the directory like above."}}
{"actor":{"display_login":"atrivisano"}}