ACF-CPT-Options-Pages | Small addon for ACF Options | Content Management System library
kandi X-RAY | ACF-CPT-Options-Pages Summary
kandi X-RAY | ACF-CPT-Options-Pages Summary
Small addon for ACF Options. Adds ACF location for each custom post type. You can install it from Wordpress Plugins Repository.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Register a post type options page .
- Setup post type options page
- Get custom post types
- Add plugin action links .
- Setup the plugin .
- Get the registered cpts .
- Render options page .
- Display admin error notice
- Load plugin textdomain .
- Load settings page template .
ACF-CPT-Options-Pages Key Features
ACF-CPT-Options-Pages Examples and Code Snippets
Community Discussions
Trending Discussions on ACF-CPT-Options-Pages
QUESTION
I'm using ACF to create pages with separate flexible layout sections in two areas, the main page section area and a sidebar area.
I have a CPT called case-studies
and have created a page called case-studies
. I have set 'has_archive' => false,
within the CPT in the hope that the page is used however (and I understand) that there is a hierarchy to this so that if no archive is given, then it will load my home.php (which is what I am using for my news, the posts post type).
Is there any way for a page to be used as an archive for a CPT? The only solution I can see at the moment is to use the ACF CPT Options Pages plugin and attached the ACF fields I have created to my 'Case Studies Archive' page however, I would have to duplicate all of my code so that they can called the right content. For example:
the_field('field_name');
to the_field('field_name', 'cpt_case-studies');
Has anyone been able to use a page as an archive for a CPT and assign a template to the page which both queries the CPT posts and have the ACF fields from the page?
Thanks very much for your help. If there is anything else I can supply, let me know.
...ANSWER
Answered 2018-Apr-24 at 12:41The best approach for this is to have the has_archive
parameter set to true
and then create an archive-case-studies.php
template in your theme. You can still make use of custom fields from ACF. When you use the_field()
and the_get()
, the second accepted parameter is the post id, but this is automatically set based on the current global object.
For example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ACF-CPT-Options-Pages
Activate the plugin through thePlugins menu in WordPress.
Go to Custom fields submenu CPT Options page and activate CPTs what you need or create subpages for that.
Create your Custom Field Group, set location rule Options Page and choose your CPT options page or subpage.
Read the documentation to display your data.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page