Home › Forums › Add-ons › Options Page › how to show custom field option in theme page?
i have install advance custom field plugin in my wordpress i have create some custom field how can i show these this option in theme?user can choose custom field in theme or page the condition is if user choose special categories then custom field are shown and user can choose these option and how to make searchable please help me…
i have create field group what i mean that how to show field group in theme not in wordpress post option not even page option …i just want to show which i have created custom field group ,that will show in theme ….for example :- like when i login in example.com and there is a form i have to fill-up like title , dis,tags ,category etc….when i click in category the custom filed group should be shown there and i can choose there option ….
1. register option page
if (function_exists('acf_add_options_page')) {
acf_add_options_page(array(
'page_title' => 'Site Options',
'menu_title' => 'Site Options',
'menu_slug' => 'acf-options',
'position' => '103.3',
'capability' => 'edit_posts',
'redirect' => false,
));
}
2. In WordPress Admin go to “Custom fielsd” menu? create new Field Group and assosiate it with your option page https://gyazo.com/13f3a19a98794439fd2e5b0228180587
3. In template (index.php or category.php) use the_field('field-name', 'options');
to show your custom field
1. how to registe option page you mean create new .php page? or create page from wp >> page >> ad new page? where i have to put this code?
if (function_exists(‘acf_add_options_page’)) {
acf_add_options_page(array(
‘page_title’ => ‘Site Options’,
‘menu_title’ => ‘Site Options’,
‘menu_slug’ => ‘acf-options’,
‘position’ => ‘103.3’,
‘capability’ => ‘edit_posts’,
‘redirect’ => false,
));
}
i have to create option page ?from wordpress>> page>>add New Page?
when i put code in functuin.php
i got this error
Parse error: syntax error, unexpected ‘Options’’ (T_STRING), expecting ‘)’ in C:\xampp\htdocs\example\wp-content\themes\theme\functions.php on line 4
I’m not a telepath and I do not see from here how you inserted the code. Take at least a screenshot
i have put this code in function.php http://prntscr.com/lp0w1h
there is no option page http://prntscr.com/lp0wz1
The topic ‘how to show custom field option in theme page?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.