Title: Theme matching
Last modified: May 9, 2023

---

# Theme matching

 *  Resolved [kokojambo](https://wordpress.org/support/users/kokojambo/)
 * (@kokojambo)
 * [3 years ago](https://wordpress.org/support/topic/theme-matching-2/)
 * Hi and thanks for an amazing plugin!
 * I’m using a theme where the developer registered CPT fields in a php file,
 * Any call to show “ts-speaker” post type looks like this:
 *     ```wp-block-code
       <?php
       // speaker details
       $exhibs_designation = exhibz_meta_option(get_the_id(), 'exhibs_designation');
       $exhibs_photo       = exhibz_meta_option(get_the_id(), 'exhibs_photo');
       $exhibs_logo        = exhibz_meta_option(get_the_id(), 'exhibs_logo');
       $exhibs_summery     = exhibz_meta_option(get_the_id(), 'exhibs_summery');
       $socials            = exhibz_meta_option(get_the_id(), 'social');
   
       ?>
       ```
   
 * found this on global.php,
 *     ```wp-block-code
       // return the specific value from metabox
   
       // ----------------------------------------------------------------------------------------
       function exhibz_meta_option($postid, $key, $default_value = '')
       {
       	if (defined('FW')) {
       		$value = fw_get_db_post_option($postid, $key, $default_value);
       	}
       	return (!isset($value) || $value == '') ? $default_value :  $value;
       }
       ```
   
 * found this on a separate plugin comes with the theme:
 *     ```wp-block-code
       <?php
   
       /**
        *
        * Custom Post Type And Taxonomies Class
        *
        */
   
       namespace ExhibzCustomPost;
   
       if ( ! defined( 'ABSPATH' ) ) exit;
   
       class Exhibz_CustomPost {
   
         private $textdomain;
         private $xs_posts;
   
           public function __construct( $textdomain){
               $this->textdomain = $textdomain;
               $this->xs_posts = array();
               add_action('init', array($this, 'register_custom_post'));
           }
   
           public function xs_init( $type, $singular_label, $plural_label, $settings = array() ){
   
               $default_settings = array(
                   'labels' => array(
                       'name' => __($plural_label, $this->textdomain),
                       'singular_name' => __($singular_label, $this->textdomain),
                       'add_new_item' => __('Add New '.$singular_label, $this->textdomain),
                       'edit_item'=> __('Edit '.$singular_label, $this->textdomain),
                       'new_item'=>__('New '.$singular_label, $this->textdomain),
                       'view_item'=>__('View '.$singular_label, $this->textdomain),
                       'search_items'=>__('Search '.$plural_label, $this->textdomain),
                       'not_found'=>__('No '.$plural_label.' found', $this->textdomain),
                       'not_found_in_trash'=>__('No '.$plural_label.' found in trash', $this->textdomain),
                       'parent_item_colon'=>__('Parent '.$singular_label, $this->textdomain),
                       'menu_name' => __($plural_label,$this->textdomain)
                   ),
                   'public'=>true,
                   'has_archive' => true,
                   'menu_icon' => '',
                   'menu_position'=>20,
                   'supports'=>array(
                       'title',
                       'editor',
                       'thumbnail'
                   ),
                   'rewrite' => array(
                       'slug' => sanitize_title_with_dashes($plural_label)
                   )
               );
               $this->xs_posts[$type] = array_merge($default_settings, $settings);
           }
   
           public function register_custom_post(){
               foreach($this->xs_posts as $key=>$value) {
                   register_post_type($key, $value);
                   flush_rewrite_rules( false );
               }
           }
   
       }
   
       class Exhibz_Taxonomies {
           protected $textdomain;
           protected $taxonomies;
   
           public function __construct ( $textdomain ){
               $this->textdomain = $textdomain;
               $this->taxonomies = array();
               add_action('init', array($this, 'register_taxonomy'));
           }
   
           public function xs_init( $type, $singular_label, $plural_label, $post_types, $settings = array() ){
               $default_settings = array(
                   'labels' => array(
                       'name' => __($plural_label, $this->textdomain),
                       'singular_name' => __($singular_label, $this->textdomain),
                       'add_new_item' => __('New '.$singular_label.' Name', $this->textdomain),
                       'new_item_name' => __('Add New '.$singular_label, $this->textdomain),
                       'edit_item'=> __('Edit '.$singular_label, $this->textdomain),
                       'update_item'=> __('Update '.$singular_label, $this->textdomain),
                       'add_or_remove_items'=> __('Add or remove '.strtolower($plural_label), $this->textdomain),
                       'search_items'=>__('Search '.$plural_label, $this->textdomain),
                       'popular_items'=>__('Popular '.$plural_label, $this->textdomain),
                       'all_items'=>__('All '.$plural_label, $this->textdomain),
                       'parent_item'=>__('Parent '.$singular_label, $this->textdomain),
                       'choose_from_most_used'=> __('Choose from the most used '.strtolower($plural_label), $this->textdomain),
                       'parent_item_colon'=>__('Parent '.$singular_label, $this->textdomain),
                       'menu_name'=>__($singular_label, $this->textdomain),
                   ),
   
                   'public'            => true,
                   'show_in_nav_menus' => true,
                   'show_admin_column' => true,
                   'hierarchical'      => true,
                   'show_tagcloud'     => false,
                   'show_ui'           => true,
                   'show_in_rest'      => true,
                   'query_var'         => true,
                   'rewrite' => array(
                       'slug' => sanitize_title_with_dashes($plural_label)
                   )
               );
   
               $this->taxonomies[$type]['post_types'] = $post_types;
               $this->taxonomies[$type]['args'] = array_merge($default_settings, $settings);       
           }
   
           public function register_taxonomy(){
               foreach($this->taxonomies as $key => $value) {
                   register_taxonomy($key, $value['post_types'], $value['args']);
               }
           }
   
       }
       ```
   
 * **Can I still use the plugin? I tried in a few ways like meta fields but it doesn’t
   really work with meta box fields.**
    -  This topic was modified 3 years ago by [kokojambo](https://wordpress.org/support/users/kokojambo/).
    -  This topic was modified 3 years ago by [kokojambo](https://wordpress.org/support/users/kokojambo/).
    -  This topic was modified 3 years ago by [kokojambo](https://wordpress.org/support/users/kokojambo/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [kokojambo](https://wordpress.org/support/users/kokojambo/)
 * (@kokojambo)
 * [3 years ago](https://wordpress.org/support/topic/theme-matching-2/#post-16723282)
 * after some investigations
 * I found the associated “category” taxonomy works fine some times, and disappears
   from the mapping page some times.
 * In addition, there is a problem with the other post type meta box fields that
   do not reach the post at all; some of them are missing in the mapping page.
 * ![](https://i0.wp.com/i.postimg.cc/QNmPb8Z5/Screenshot-2.pnghttps%3A//i.postimg.
   cc/QNmPb8Z5/Screenshot-2.png?resize=94%2C128&ssl=1)
 * ![](https://i0.wp.com/i.postimg.cc/KcgYCHQ0/Screenshot-3.png?resize=168%2C83&
   ssl=1)
 * ![](https://i0.wp.com/i.postimg.cc/xTDdQ34n/Screenshot-4.png?resize=50%2C41&ssl
   =1)
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [3 years ago](https://wordpress.org/support/topic/theme-matching-2/#post-16723502)
 * > **Can I still use the plugin? I tried in a few ways like meta fields but it
   > doesn’t really work with meta box fields.**
 * Difficult to say given it isn’t clear how your plugin stores its meta fields.
   If it uses WP std procedures to do then it’s easy to get the plugin to map your
   form to your post. Post My CF7 Form is designed to extend WP core functionality.
 * You need to find out how the CPT fields are stored and then map your form to 
   those fields
 *  Thread Starter [kokojambo](https://wordpress.org/support/users/kokojambo/)
 * (@kokojambo)
 * [3 years ago](https://wordpress.org/support/topic/theme-matching-2/#post-16726732)
 * Hi dear Aurovrata and thanks for your response,
 * On your advice, I dug deep into the template files to understand how the fields
   and post type are configured.
    1. setting up custom post type:
 *     ```wp-block-code
       <?php
   
       /**
        *
        * Custom Post Type And Taxonomies Class
        *
        */
   
       namespace ExhibzCustomPost;
   
       if ( ! defined( 'ABSPATH' ) ) exit;
   
       class Exhibz_CustomPost {
   
         private $textdomain;
         private $xs_posts;
   
           public function __construct( $textdomain){
               $this->textdomain = $textdomain;
               $this->xs_posts = array();
               add_action('init', array($this, 'register_custom_post'));
           }
   
           public function xs_init( $type, $singular_label, $plural_label, $settings = array() ){
   
               $default_settings = array(
                   'labels' => array(
                       'name' => __($plural_label, $this->textdomain),
                       'singular_name' => __($singular_label, $this->textdomain),
                       'add_new_item' => __('Add New '.$singular_label, $this->textdomain),
                       'edit_item'=> __('Edit '.$singular_label, $this->textdomain),
                       'new_item'=>__('New '.$singular_label, $this->textdomain),
                       'view_item'=>__('View '.$singular_label, $this->textdomain),
                       'search_items'=>__('Search '.$plural_label, $this->textdomain),
                       'not_found'=>__('No '.$plural_label.' found', $this->textdomain),
                       'not_found_in_trash'=>__('No '.$plural_label.' found in trash', $this->textdomain),
                       'parent_item_colon'=>__('Parent '.$singular_label, $this->textdomain),
                       'menu_name' => __($plural_label,$this->textdomain)
                   ),
                   'public'=>true,
                   'has_archive' => true,
                   'menu_icon' => '',
                   'menu_position'=>20,
                   'supports'=>array(
                       'title',
                       'editor',
                       'thumbnail'
                   ),
                   'rewrite' => array(
                       'slug' => sanitize_title_with_dashes($plural_label)
                   )
               );
               $this->xs_posts[$type] = array_merge($default_settings, $settings);
           }
   
           public function register_custom_post(){
               foreach($this->xs_posts as $key=>$value) {
                   register_post_type($key, $value);
                   flush_rewrite_rules( false );
               }
           }
   
       }
   
       class Exhibz_Taxonomies {
           protected $textdomain;
           protected $taxonomies;
   
           public function __construct ( $textdomain ){
               $this->textdomain = $textdomain;
               $this->taxonomies = array();
               add_action('init', array($this, 'register_taxonomy'));
           }
   
           public function xs_init( $type, $singular_label, $plural_label, $post_types, $settings = array() ){
               $default_settings = array(
                   'labels' => array(
                       'name' => __($plural_label, $this->textdomain),
                       'singular_name' => __($singular_label, $this->textdomain),
                       'add_new_item' => __('New '.$singular_label.' Name', $this->textdomain),
                       'new_item_name' => __('Add New '.$singular_label, $this->textdomain),
                       'edit_item'=> __('Edit '.$singular_label, $this->textdomain),
                       'update_item'=> __('Update '.$singular_label, $this->textdomain),
                       'add_or_remove_items'=> __('Add or remove '.strtolower($plural_label), $this->textdomain),
                       'search_items'=>__('Search '.$plural_label, $this->textdomain),
                       'popular_items'=>__('Popular '.$plural_label, $this->textdomain),
                       'all_items'=>__('All '.$plural_label, $this->textdomain),
                       'parent_item'=>__('Parent '.$singular_label, $this->textdomain),
                       'choose_from_most_used'=> __('Choose from the most used '.strtolower($plural_label), $this->textdomain),
                       'parent_item_colon'=>__('Parent '.$singular_label, $this->textdomain),
                       'menu_name'=>__($singular_label, $this->textdomain),
                   ),
   
                   'public'            => true,
                   'show_in_nav_menus' => true,
                   'show_admin_column' => true,
                   'hierarchical'      => true,
                   'show_tagcloud'     => false,
                   'show_ui'           => true,
                   'show_in_rest'      => true,
                   'query_var'         => true,
                   'rewrite' => array(
                       'slug' => sanitize_title_with_dashes($plural_label)
                   )
               );
   
               $this->taxonomies[$type]['post_types'] = $post_types;
               $this->taxonomies[$type]['args'] = array_merge($default_settings, $settings);       
           }
   
           public function register_taxonomy(){
               foreach($this->taxonomies as $key => $value) {
                   register_taxonomy($key, $value['post_types'], $value['args']);
               }
           }
   
       }
       ```
   
 * 2. setting up meta fields:
 *     ```wp-block-code
       <?php if (!defined('FW')) {
           die('Forbidden');
       }
   
   
       $options = array(
   
   
           'exhibs_speaker_id'     => array(
               'type'    => 'tab',
               'options' => array(
                   array(
                       'type'    => 'tab',
                       'options' => array(
                           'exhibs_designation' => array(
                               'label' => esc_html__('Designation', 'exhibz'),
                               'type'  => 'text',
                               'value' => '',
   
                           ),
                           'exhibs_photo'       => array(
                               'label'       => esc_html__('Profile Photo', 'exhibz'),
                               'type'        => 'upload',
                               'value'       => array(),
                               'images_only' => true,
                               'files_ext'   => array('jpg', 'jpeg', 'png'),
   
                           ),
                           'exhibs_logo'        => array(
                               'label'       => esc_html__('Logo', 'exhibz'),
                               'type'        => 'upload',
                               'value'       => array(),
                               'images_only' => true,
                               'files_ext'   => array('jpg', 'jpeg', 'png'),
   
                           ),
   
                           'exhibs_summery' => array(
                               'label' => esc_html__('Summary', 'exhibz'),
                               'type'  => 'wp-editor',
                               'value' => '',
   
                           ),
   
   
                       ),
   
                   )
               ),
               'title'   => esc_html__('Speaker Details', 'exhibz'),
   
   
           ),
           "social"                => array(
               'type'            => 'addable-popup',
               'label'           => esc_html__('Social Link', 'exhibz'),
               'template'        => '{{- option_site_name }}',
               'popup-title'     => 'Social Media Link',
               'size'            => 'small', // small, medium, large
               'limit'           => 0, // limit the number of popup`s that can be added
               'add-button-text' => esc_html__('Add ', 'exhibz'),
               'sortable'        => true,
               'popup-options'   => array(
                   'option_site_name' => array(
                       'label' => esc_html__('Website Name', 'exhibz'),
                       'type'  => 'text',
                       'value' => ''
   
                   ),
                   'option_site_link' => array(
                       'label' => esc_html__('Website Link', 'exhibz'),
                       'type'  => 'text',
                       'value' => ''
   
                   ),
                   'option_site_icon' => array(
                       'label' => esc_html__('Icon', 'exhibz'),
                       'type'  => 'new-icon',
                       'value' => ''
   
                   ),
   
               ),
           ),
           'speaker_speaker_style' => array(
               'type'    => 'tab',
               'options' => array(
                   array(
                       'type'    => 'tab',
                       'options' => array(
                           'speaker_color' => array(
                               'type'     => 'color-picker',
                               'value'    => '#25CD44',
                               'palettes' => array('#8000FF', '#00C1B4', '#00B4FF', '#002BFF', '#9A8D17' . '#FF2661'),
                               'label'    => __('Color', 'exhibz'),
                           )
                       ),
                   )
               ),
               'title'   => esc_html__('Speaker Style Square Alter', 'exhibz'),
           )
       );
       ```
   
 * The fields that “Post My CF7 Form” manages to locate on its own, do not end up
   in the post itself and it is created with title only (e.g. designation, photo):
 * ![](https://i0.wp.com/i.postimg.cc/Y0Vdfxrd/Presentation1.jpg?ssl=1)
 * Additional fields do not appear at all under the meta fields dropdown (e.g. logo):
 * ![](https://i0.wp.com/i.postimg.cc/SQW6sD4D/SADOT.png?ssl=1)
 * **What would you recommend to do? How can I proceed with the mapping?**
    -  This reply was modified 3 years ago by [kokojambo](https://wordpress.org/support/users/kokojambo/).
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/theme-matching-2/#post-16779354)
 * Indeed so the fields are stored as post meta-fields which the plugin recognises,
   however, it is still not clear how the values are stored in the DB. If you want
   your CPT to be properly filled-in with the form mapping, you need to make sure
   that the submitted data is stored in the format that your theme CPT expects it
   to be. This will require custom programmatic storage, which you can achieve using
   the filter hooks available in the plugin. For example, images can be stored multiple
   ways in the DB, it can be a direct URL to the image on the server (this is the
   plugin default), it can also be a file path value, or it can be an attachment
   post ID value, whereby the image is first stored as an attachment post (like 
   those you upload in the media section of the dashboard), but which takes up much
   more space.
 *  Thread Starter [kokojambo](https://wordpress.org/support/users/kokojambo/)
 * (@kokojambo)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/theme-matching-2/#post-16779661)
 * Thank you very much! I will learn more about the plugin related filter hooks.
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/theme-matching-2/#post-16779687)
 * You will need to use a tool like PhpMyAdmin to inspect your DB and see how the
   default mapping saves values compared to a post created directily in the dashboard.
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/theme-matching-2/#post-16886571)
 * [@kokojambo](https://wordpress.org/support/users/kokojambo/) please do leave 
   a [review](https://wordpress.org/support/plugin/post-my-contact-form-7/reviews/)
   when you have a moment to spare

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Theme matching’ is closed to new replies.

 * ![](https://ps.w.org/post-my-contact-form-7/assets/icon-256x256.png?rev=1985682)
 * [Post My CF7 Form](https://wordpress.org/plugins/post-my-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-my-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-my-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-my-contact-form-7/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/theme-matching-2/#post-16886571)
 * Status: resolved