Plugins: Custom fields
We must save a structured data for a post and that data will be stored as custom fields. Plugin for that is.
To retrieve custom field data in theme:
$price = get_post_meta( get_the_ID(), 'product_price', true );
The only file I will edit is loop.php
as this file is responsible for
displaying a voucher.
Files for displaying voucher lists are search.php
as search results
and template-blog.php
as the most common one.
New custom fields
I field name is beginning with underscore, it will be invisible to a user.
Fields:
voucher_uid
as unique ID.
If detected and has some non-empty value, the voucher will be displayed by using custom fields, and not by manual entry.voucher_name
as main titlevoucher_store
as store namevoucher_info
as information for customervoucher_couponcode
as coupon codevoucher_trackinglink
as a link for affiliate trackingvoucher_trackpixel
as a tracking pixel
Notes
I considered making a template support in posts, as in pages. For that I would use Single Post Template plugin. But, since we already heavily modified Sahifa theme, I decided to hardcode that.
Editing custom fields
In Wordpress language, it is called custom write panels or meta boxes. The plugins available were:
In a more manual way:
Chosen plugin: Advanced Custom Fields
For me, it was important to have custom fields separate - not as one huge custom value. In this way, it should be compatible with most of the plugins.
So I chose Advanced Custom Fields
Settings are really not working right now?
In theme /wp-content/themes/sahifa/
, file functions.php
put this
line to hide admin page.
add_filter('acf/settings/show_admin', '__return_false');
Force English language in Admin area:
add_filter('acf/settings/current_language', 'current_language');
function my_acf_current_language() { return 'en'; }
ACF | How to Hide ACF Menu from Clients Hide menu item not working in ACF 5
Extras
Plugin for bulk editing of custom fields: https://wordpress.org/plugins/custom-field-bulk-editor/
Miscellaneous resources
Custom Types, Metaboxes, etc.
Create Custom Single Post Templates for Specific Posts or Sections in WordPress WordPress › Types - Custom Fields and Custom Post Types Management Custom Fields « WordPress Codex WordPress › Advanced Custom Fields WordPress Custom Fields 101: Tips, Tricks, and Hacks
WordPress › Search for Magic Fields WordPress › Search for custom WordPress › Magic Fields 2 Toolkit WordPress › Magic Fields 2 WordPress › Simple Fields best custom fields plugin wordpress - Google Search WordPress › Advanced Custom Fields WordPress › Support » What plugin think is best for Custom Fields? WP-Types Vs AdvancedCF vs PODS Compare WP - Plugin Comparison - Content Type / Custom Fields - Google Sheets Best WordPress Plugins for Creating Custom Fields and Post Types - WP Mayor WordPress › Advanced Custom Fields custom fields in pages wordpress - Google Search How to enable custom fields for pages (if not a bad practice)? - WordPress Development Stack Exchange
How to integrate custom database table in Wordpress and using Wordpress functions Post Types « WordPress Codex Must Use Plugins « WordPress Codex Custom Post Type Snippets to make you smile • Yoast plugin “custom post type” - Google Search WordPress › Types - Custom Fields and Custom Post Types Management WordPress › Custom Post Type Maker When Do You Need a Custom Post Type or Taxonomy in WordPress WordPress Custom Fields 101: Tips, Tricks, and Hacks WordPress › Custom Field Template WordPress › More Fields Extend WordPress With Custom Fields - Smashing Magazine Using WordPress Custom Fields, Part I: The Basics | Perishable Press WordPress Custom Fields, Part II: Tips and Tricks | Perishable Press WordPress › metaboxes « Tags Edit Post ‹ save-up.ch — WordPress You searched for Outfittery Gutschein - save-up.ch Creating A Customizable Post List Template in WordPress With Advanced Custom Fields - WPMU DEV
A bug in settings of Advanced Custom Fields plugin
I want to hide admin page by adding filter for settings, but that way is not working. Also, forcing a language is also not working.
Please, do this and enable admin menu by editing file:
/www/wp-content/themes/sahifa/custom-functions.php
Custom Fields, Meta Boxes, Custom Post Types
ACF plugin je za: Custom Fields
jmslbam/advanced-custom-fields-wpcli - Libraries.io
Dunno!
But the best for me is: Carbon Fields. Woow! And it is really-free But also: CMB2 5+ Best Custom Fields Plugin for WordPress - PickPlugins Blog CMB2 is great, but it does not feel very “premium”
Great starter theme: Rodgath/n00b-Theme: Simple WordPress starter theme. with all this: Rodgath/Dilaz-Metabox-Plugin: WordPress metaboxes for themes and plugins.
GitHub - Rodgath/Dilaz-Metabox-Plugin: WordPress metaboxes for themes and plugins.
GitHub - alispx/quickfield Move away from CMB2 · Issue #44 · wpsight/wpcasa · GitHub
Custom Metaboxes - WP Georgetown Really really good review: Meta Box – A replacement for Advanced Custom Fields?
Store in ACF Fields in separate table, plugin is ACF Custom Database Tables Awesome ACF - Resources for Advanced Custom Fields or you can try manually: ACF Custom Fields Stored in Custom Table
we think that it’s not a good idea to build your custom fields through the admin UI (as in ACF) — this way you disconnect the field definition from the version control, i.e. from the changes in the templates that actually render the custom field values.
Decision
Carbon Fields seems better, but ACF is “brute-force by popularity”, and is not so much worse.
Maybe I will use ACF for multiple reasons:
- you can use it as Carbon Fields or any better plugin via ACF Theme Code Pro that will generate the code you put in PHP but even better, there is feature ACF Local JSON that’s perfect!
- only one that supports writing into separate database tables: ACF Custom Database Tables
- has the most support from other compatible plugins. Almost everything supports ACF - important ones: WP All Import,
- great 3rd-party fields, for example ACF Focal Point
- you can also include it in code, not like plugin. See Including ACF within a plugin or theme
- in Pro version, Gutenberg Blocks are supported properly in a same manner as in Carbon Fields
Only if I need something commercial, I would use Carbon Fields. For my custom products, incorporate ACF in projects.
Custom Fields Revisited
- Pods Framework izgleda vrhunski i open source je. Ima GUI. Nije baš podržan savršeno i nema Gutenberg custom blocks nego svoje.
- Toolset by the makers of WMPL, OnTheGoSystems
- CMB2 skroz open source i ima repeaters, ali nema nikakav GUI
- Carbon Fields mi se čini da je stao sa razvojem
- Simple Fields is dead meat now
Also:
Custom Field Suite
Custom Field Suite je od poznatog developera i aktivno se razvija na repo mgibbs189/custom-field-suite i u pitanju je pravi open-source koji ne pokušava ništa da ti proda. Poseduje sva polja koja su neophodna kao što je Loop za repeatable fields i Relationship field a još mnogo se dodate kroz pluginove.
Ima baš dosta dodataka za ovaj plugin. Navešću samo od nekih:
CFS Options Screens Boost Yoast Analysis CFS CFS Yoast Analysis CFS Auto Loop Label robneu/cfs-markdown TomodomoCo/cfs-advanced-text-field evom/custom-field-suite-video ersoma/cfs-time CFS – Contact Form 7 Field
Complex Meta Fields je abnadoned ali je karatkerističan po tome što podržava Repeater fields potpuno besplatno.
This is the only completely free plugin for custom fields koji podržava Repeater i Post i Taxonomy Relations, Custom post types, even though its name is misleading. Postoji i Pro verzija ali ona dodaje funkcije koje se ne podrazumevaju i nisu neophodne, kao Admin pages.
Takođe odličan custom fields plugin, ali ne za kreaciju već za kontrolu, melonpan za manipulaciju klasičnim Custom Fields Post Meta Controls na repo garciaalvaro/post-meta-controls: Register, save and modify post meta data in the Gutenberg editor.. Pošto ne podržava Repeater, odličan je za osnovnu upotrebu.