All Projects → Tusko → ACF-CPT-Options-Pages

Tusko / ACF-CPT-Options-Pages

Licence: GPL-3.0 license
Small addon for ACF Options. Adds ACF options page per custom post type

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ACF-CPT-Options-Pages

ACF-3
ACF
Stars: ✭ 37 (-49.32%)
Mutual labels:  addon, acf
SubServers-2
SubServers – The Minecraft Server Management Platform
Stars: ✭ 80 (+9.59%)
Mutual labels:  addon
VSE Transform Tools
Quickly transform, crop and fade video strips in Blender's Video Sequence Editor
Stars: ✭ 195 (+167.12%)
Mutual labels:  addon
blender-addon-for-trackmania-and-maniaplanet
Blender addon for trackmania2020 & maniaplanet. 1 Click export & convert to .gbx.
Stars: ✭ 18 (-75.34%)
Mutual labels:  addon
yet-another-pinboard-extension
Manage your Pinboard bookmarks in your browser.
Stars: ✭ 27 (-63.01%)
Mutual labels:  addon
acf-field-boilerplate
Modernized PSR-2 boilerplate for creating custom fields for ACF5.
Stars: ✭ 54 (-26.03%)
Mutual labels:  acf
addon-tor
Tor - Home Assistant Community Add-ons
Stars: ✭ 37 (-49.32%)
Mutual labels:  addon
Anki-Night-Mode
Enabling studying at night with Anki - without eye strain
Stars: ✭ 72 (-1.37%)
Mutual labels:  addon
acf-swatch
ACF Color Swatch Field
Stars: ✭ 67 (-8.22%)
Mutual labels:  acf
acf-openstreetmap-field
WordPress ACF Field for OpenStreetMap
Stars: ✭ 88 (+20.55%)
Mutual labels:  acf
tsaotun
Tsaotun - Python based Assistance for Docker
Stars: ✭ 51 (-30.14%)
Mutual labels:  addon
ember-legit-forms
Component for creating flexible forms along with validations.
Stars: ✭ 41 (-43.84%)
Mutual labels:  addon
BSkyBlock
BSkyBlock add-on for BentoBox (Discord link: https://discordapp.com/invite/T5HxmvK)
Stars: ✭ 103 (+41.1%)
Mutual labels:  addon
repo-scrapers
Official source repository for Kodi scraper add-ons
Stars: ✭ 27 (-63.01%)
Mutual labels:  addon
Google-4-TbSync
This provider add-on adds Google synchronization capabilities to TbSync. Only contacts and contact groups are currently managed, using Google's People API.
Stars: ✭ 36 (-50.68%)
Mutual labels:  addon
DuBLF DuBlast
Quick Playblast tool for Blender
Stars: ✭ 18 (-75.34%)
Mutual labels:  addon
ember-app-scheduler
An Ember addon to schedule work until after the initial render.
Stars: ✭ 67 (-8.22%)
Mutual labels:  addon
ClayTech
An addon for slimefun.
Stars: ✭ 15 (-79.45%)
Mutual labels:  addon
djangocms-file
django CMS File is a set of plugins for django CMS that allow you to add files to your site You can either choose a single file or an entire folder.
Stars: ✭ 30 (-58.9%)
Mutual labels:  addon
KAM
The ACE Advanced Medical System is nice, but we can do it better, even on a more realistic way and bring it on another level with these addons.
Stars: ✭ 19 (-73.97%)
Mutual labels:  addon

ACF CPT Options Pages

Small addon for ACF Options. Adds ACF location for each custom post type.

You can install it from Wordpress Plugins Repository

New feature in the major version 2!

Now you can activate/deactivate CPTs and create custom options pages for each CPT. By default, options pages are activated for all custom post types.

Installation

  • Upload 'acf-cpt-options-pages' to the /wp-content/plugins/ directory.
  • 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.

Preview

Usage

The default functions of ACF plugin (get_field, the_field, etc.) can be used to load values from a CPT Options Pages, but second parameter is required to target the CPT options.

This is similar to passing through a $post_id parameter to target a specific post object.

The $post_id parameter needed is a string containing the cpt_ and CPT name in the following format; "cpt_{CPT_NAME}" and for subpages you can copy generated ID while creating subpages.

Examples

In examples projects is a Custom Post Type name.

So, let's go!

Display a field

<p><?php the_field('field_name', 'cpt_projects'); ?></p>

and the subpage field

<p><?php the_field('field_name', 'cpt_projects_testpage'); ?></p>

Retrieve a field

<?php
    $field = get_field('field_name', 'cpt_projects');
    // do something with $field
?>

Display a sub field

<?php if( have_rows('repeater_name', 'cpt_projects') ): ?>
    <ul>
        <?php while( have_rows('repeater_name', 'cpt_projects') ): the_row(); ?>
            <li><?php the_sub_field('the_title'); ?></li>
        <?php endwhile; ?>
    </ul>
<?php endif; ?>

Display with shortcode

[acf field="field_name" post_id="cpt_projects"]

Please read documentation about shortcodes with ACF

Customization

Add in your functions.php

function cpt_projects_customize($cptmenu) {
    $cptmenu['page_title'] = 'Dev Custom title';
    $cptmenu['menu_title'] = 'Dev Custom title';
    return $cptmenu;
}

add_filter('cpt_projects_acf_page_args', 'cpt_projects_customize');

Don't forget to replace cpt_projects_ to your custom post type name :) It works only for first level options pages, not for subpages.

License

Copyright (c) 2021, Tusko Trush

See LICENSE for more info.

Requirements

You must buy ACF PRO or ACF Options Page Addon.

Translation

qTranslate-XT

This plugin is compatible and has included ACF qTranslate. Just enjoy!

qTranslate-X

If you are using qTranslate-X, you must install ACF qTranslate.

WPML/Polylang

If you are using WPML or Polylang, you must add constant ICL_LANGUAGE_CODE to post_id, for example: get_field('archive_title', 'cpt_projects_' . ICL_LANGUAGE_CODE).

Contributors


Tusko Trush

Chief :D

Máté Farkas

i18n Support

Sauli Rajala

Customizations

If you have any questions on this please post an issue/question: https://github.com/Tusko/ACF-CPT-Options-Pages/issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].