Last active
June 11, 2024 15:07
-
-
Save MjHead/5dac7f0182549b08cfc257d9ea6f14e3 to your computer and use it in GitHub Desktop.
JetEngine. Get registered meta fields by given context - post type, taxonomy or user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get fields for the given context and object | |
* Should be called on hook 'init' with priority 11 or later | |
*/ | |
// Fields for Post post type | |
$post_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type', 'post' ); | |
// Fields for Product post type | |
$product_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type', 'product' ); | |
// Fields for Category taxonomy | |
$category_fields = jet_engine()->meta_boxes->get_fields_for_context( 'taxonomy', 'category' ); | |
// All field groups for Users | |
$user_field_groups = jet_engine()->meta_boxes->get_fields_for_context( 'user' ); | |
// All CPT fields | |
$cpt_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes sir. Took me a while from this post but got it working
This is for an options page, but in single page posts works the same just extract the array in a variable
Now loop over the repeater as a single $item
$item['sub field of the repeater']
You do the rest of the HTML and PHP.