I need to create a child plugin for a popular plugin
There are a few functions in the main plugin that I need to edit (by the Child plugin) How do I do this?
Note: There is a function in the main plugin, I just need to add code to it with the plugin child
Desired function:
function dokan_get_social_profile_fields() {
$fields = array(
'fb' => array(
'icon' => 'facebook-square',
'title' => __( 'Facebook', 'dokan-lite' ),
),
'gplus' => array(
'icon' => 'google',
'title' => __( 'Google', 'dokan-lite' ),
),
'twitter' => array(
'icon' => 'twitter-square',
'title' => __( 'Twitter', 'dokan-lite' ),
),
'pinterest' => array(
'icon' => 'pinterest-square',
'title' => __( 'Pinterest', 'dokan-lite' ),
),
'linkedin' => array(
'icon' => 'linkedin-square',
'title' => __( 'LinkedIn', 'dokan-lite' ),
),
'youtube' => array(
'icon' => 'youtube-square',
'title' => __( 'Youtube', 'dokan-lite' ),
),
'instagram' => array(
'icon' => 'instagram',
'title' => __( 'Instagram', 'dokan-lite' ),
),
'flickr' => array(
'icon' => 'flickr',
'title' => __( 'Flickr', 'dokan-lite' ),
),
);
return apply_filters( 'dokan_profile_social_fields', $fields );
}
The amount I need to add to it with the Child Plugin:
,
'telgram' => array(
'icon' => 'telgram',
'title' => __( 'Telgram', 'dokan-lite' ),
),
'discord' => array(
'icon' => 'discord',
'title' => __( 'Discord', 'dokan-lite' ),
),
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
i created a custom post type but i only get default support features like thumbnails, exerpt etc but what i want is to add all extra features of ceris theme in posts into my custom post type can you help me out?
$args = array(
'label' => __( 'directory', 'Ceris' ),
'description' => __( 'directory all posts', 'Ceris' ),
'labels' => $labels,
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor', 'excerpt','thumbnail', 'comments', 'revisions', 'custom-fields','post-formats','page-attributes','bk_review_score' ),
// You can associate this CPT with a taxonomy or custom taxonomy.
'taxonomies' => array( 'posts' ),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'show_in_rest' => true,
);
check my support array like i'm trying to add bk_review_system into my cpt
yes you can do it
try the following code, BK come with a filter to add widget and there configuration
function bk_child_register_meta_boxes($meta_boxes) {
$meta_boxes[] = array(
'id' => 'bk_review',
'title' => esc_html__( 'BK Review System', 'ceris' ),
'pages' => array( 'directory' ),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'type' => 'heading',
'name' => esc_html__('Author Review', 'ceris'),
'desc' => esc_html__('This section allow you to give your review, pros, cons', 'ceris'),
),
// Enable Review
array(
'name' => esc_html__( 'Review Box', 'ceris' ),
'id' => 'bk_review_checkbox',
'type' => 'checkbox',
'desc' => esc_html__( 'Enable Review On This Post', 'ceris' ),
'std' => 0,
),
array(
'visible' => array( 'bk_review_checkbox', '=', 1),
'type' => 'divider',
),
array(
'id' => 'bk_review_box_position',
'name' => esc_html__( 'Review Box Position', 'ceris' ),
'type' => 'select',
'options' => array(
'default' => esc_html__( 'Default -- Under the post content', 'ceris' ),
'top' => esc_html__( 'On top of the post content ', 'ceris' ),
),
// Select multiple values, optional. Default is false.
'multiple' => false,
'std' => 'default',
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'visible' => array( 'bk_review_checkbox', '=', 1),
'type' => 'divider',
),
array(
'name' => 'Product Image',
'id' => 'bk_review_product_img',
'type' => 'single_image',
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'name' => esc_html__( 'Product name', 'ceris' ),
'id' => 'bk_review_box_title',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'name' => esc_html__( 'Description', 'ceris' ),
'id' => 'bk_review_box_sub_title',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'visible' => array( 'bk_review_checkbox', '=', 1),
'type' => 'divider',
),
//Review Score
array(
'name' => esc_html__( 'Review Score', 'ceris' ),
'id' => 'bk_review_score',
'class' => 'ceris-',
'type' => 'slider',
'visible' => array( 'bk_review_checkbox', '=', 1),
'js_options' => array(
'min' => 0,
'max' => 10.05,
'step' => .1,
),
),
array(
'visible' => array( 'bk_review_checkbox', '=', 1),
'type' => 'divider',
),
// Summary
array(
'name' => esc_html__( 'Summary', 'ceris' ),
'id' => 'bk_review_summary',
'type' => 'textarea',
'cols' => 20,
'rows' => 4,
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'visible' => array( 'bk_review_checkbox', '=', 1),
'type' => 'divider',
),
//Pros & Cons
array(
'name' => esc_html__( 'Pros and Cons', 'ceris' ),
'id' => 'bk_pros_cons',
'type' => 'checkbox',
'desc' => esc_html__( 'Enable Pros and Cons On This Post', 'ceris' ),
'std' => 0,
'visible' => array( 'bk_review_checkbox', '=', 1),
),
array(
'visible' => array( 'bk_pros_cons', '=', 1),
'type' => 'divider',
),
array(
'name' => esc_html__( 'Pros Title', 'ceris' ),
'id' => 'bk_review_pros_title',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'visible' => array( 'bk_pros_cons', '=', 1),
),
array(
'name' => esc_html__( 'Pros (Advantages)', 'ceris' ),
'id' => 'bk_review_pros',
'type' => 'textarea',
'cols' => 20,
'clone' => true,
'rows' => 2,
'visible' => array( 'bk_pros_cons', '=', 1),
),
array(
'visible' => array( 'bk_pros_cons', '=', 1),
'type' => 'divider',
),
array(
'name' => esc_html__( 'Cons Title', 'ceris' ),
'id' => 'bk_review_cons_title',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'visible' => array( 'bk_pros_cons', '=', 1),
),
array(
'name' => esc_html__( 'Cons (Disadvantages)', 'ceris' ),
'id' => 'bk_review_cons',
'type' => 'textarea',
'cols' => 20,
'clone' => true,
'rows' => 2,
'visible' => array( 'bk_pros_cons', '=', 1),
),
array(
'type' => 'divider',
),
array(
'type' => 'heading',
'name' => esc_html__('Performance and User Review', 'ceris'),
'desc' => esc_html__('This section allow you to have some criterias and allow your reader to share their review', 'ceris'),
),
array(
'name' => esc_html__( 'Performance and User Review Check Box', 'ceris' ),
'id' => 'bk_performance_review_checkbox',
'type' => 'checkbox',
'desc' => esc_html__( 'Enable This Review', 'ceris' ),
'std' => 0,
),
array(
'visible' => array( 'bk_performance_review_checkbox', '=', 1),
'type' => 'divider',
),
array(
'id' => 'bk_performance_review_score_criteria_group',
// Group field
'type' => 'group',
// Clone whole group?
'clone' => true,
'visible' => array( 'bk_performance_review_checkbox', '=', 1),
// Sub-fields
'fields' => array(
array(
'name' => esc_html__( 'Criteria Title', 'ceris' ),
'id' => 'review_criteria_title',
'type' => 'text',
),
array(
'name' => esc_html__( 'Criteria Score', 'ceris' ),
'id' => 'review_criteria_score',
'class' => 'ceris-',
'type' => 'slider',
'js_options' => array(
'min' => 0,
'max' => 10.05,
'step' => .1,
),
),
),
),
array(
'type' => 'divider',
),
array(
'name' => esc_html__( 'Reader Review Form', 'ceris' ),
'id' => 'bk_reader_review_checkbox',
'visible' => array( 'bk_performance_review_checkbox', '=', 1),
'type' => 'checkbox',
'desc' => esc_html__( 'Enable Reader Review', 'ceris' ),
'std' => 0,
),
)
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'bk_child_register_meta_boxes', 999,1 );
How do I get the settings to the frontend? I need to add classes to vc_row.
/**
* Ken Burns Effect for Row.
*/
add_action( 'vc_after_init', 'ken_burns_effect_add_option_to_vc_row' );
function ken_burns_effect_add_option_to_vc_row() {
// Ken Burns Effect Attributes
$ken_burns_effect_attributes =
array(
array(
'type' => 'checkbox',
'heading' => __( 'Ken Burns for image background', 'ken_burns_effect' ),
'param_name' => 'enable_ken_burns_effect',
'value' => array(
__( 'Yes', 'ken_burns_effect' ) => 'yes',
),
'description' => 'Check this box if you want to enable ken burns effect for this row.',
),
array(
'type' => 'dropdown',
'heading' => __( 'Direction', 'ken_burns_effect' ),
'param_name' => 'direction_ken_burns_effect',
'value' => array(
'Zoom In' => 'zoom_in',
'Zoom Out' => 'zoom_out',
),
'description' => __( '', 'ken_burns_effect' ),
'dependency' => array(
'element' => 'enable_ken_burns_effect',
'value' => array( 'yes' ),
),
),
array(
'type' => 'textfield',
'heading' => __( 'Transition speed', 'ken_burns_effect' ),
'param_name' => 'transition_speed_ken_burns_effect',
'value' => '',
'description' => __( '', 'ken_burns_effect' ),
'dependency' => array(
'element' => 'enable_ken_burns_effect',
'value' => array( 'yes' ),
),
),
);
vc_add_params( 'vc_row', $ken_burns_effect_attributes);
}
You will have to override the vc_row.php by copying it to your theme or plugin.
You can check their documentation on how to set the override directory: https://kb.wpbakery.com/docs/inner-api/vc_set_shortcodes_templates_dir/
Then you can use your custom params inside vc_row.php using their param_name eg:
$enable_ken_burns_effect;
$direction_ken_burns_effect;
$transition_speed_ken_burns_effect;
Keep in mind that you have to override vc_row_inner.php too if you want to use options there. Same goes for section and columns.
I am trying to use Redux inside the wordpress theme and not as a plugin. In functions.php I included both redux-framework.php and sample-config.php .
Now I need to create a repeater field.
From Redux doc, I got the following code to use in order to create a repeater field:
$this->sections[] = array(
'title' => __('Repeater Field', 'redux-framework-demo' ),
'icon' => 'el-icon-thumbs-up',
'fields' => array(
array(
'id' => 'repeater-field-id',
'type' => 'repeater',
'title' => __( 'Title', 'redux-framework-demo' ),
'subtitle' => __( '', 'redux-framework-demo' ),
'desc' => __( '', 'redux-framework-demo' ),
//'group_values' => true, // Group all fields below within the repeater ID
//'item_name' => '', // Add a repeater block name to the Add and Delete buttons
//'bind_title' => '', // Bind the repeater block title to this field ID
//'static' => 2, // Set the number of repeater blocks to be output
//'limit' => 2, // Limit the number of repeater blocks a user can create
//'sortable' => false, // Allow the users to sort the repeater blocks or not
'fields' => array(
array(
'id' => 'title_field',
'type' => 'text',
'placeholder' => __( 'Title', 'redux-framework-demo' ),
),
array(
'id' => 'text_field',
'type' => 'text',
'placeholder' => __( 'Text Field', 'redux-framework-demo' ),
),
array(
'id' => 'select_field',
'type' => 'select',
'title' => __( 'Select Field', 'redux-framework-demo' ),
'options' => array(
'1' => __( 'Option 1', 'redux-framework-demo' ),
'2' => __( 'Option 2', 'redux-framework-demo' ),
'3' => __( 'Option 3', 'redux-framework-demo' ),
),
'placeholder' => __( 'Listing Field', 'redux-framework-demo' ),
),
)
)
)
);
but if I place the code inside functions.php, what will the $this variable refer to? It'll produce errors. So how to use the snippet so that I can retrieve the values from template files as well?
You have to tried an old version system to create a section. You can try the new version system, I'm not sure if this works or not, but you can try this way:
Redux::setSection($opt_name, array(
'title' => __('Ads Sections', 'cbnews'),
'id' => 'ads-sections',
'desc' => __('You can manage your ads', 'cbnews'),
'icon' => 'dashicons dashicons-dashboard',
'fields' => array(
array(
'id' => 'repeater-field-id',
'type' => 'repeater',
'title' => __( 'Title', 'redux-framework-demo' ),
'subtitle' => __( '', 'redux-framework-demo' ),
'desc' => __( '', 'redux-framework-demo' ),
//'group_values' => true, // Group all fields below within the repeater ID
//'item_name' => '', // Add a repeater block name to the Add and Delete buttons
//'bind_title' => '', // Bind the repeater block title to this field ID
//'static' => 2, // Set the number of repeater blocks to be output
//'limit' => 2, // Limit the number of repeater blocks a user can create
//'sortable' => false, // Allow the users to sort the repeater blocks or not
'fields' => array(
array(
'id' => 'title_field',
'type' => 'text',
'placeholder' => __( 'Title', 'redux-framework-demo' ),
),
array(
'id' => 'text_field',
'type' => 'text',
'placeholder' => __( 'Text Field', 'redux-framework-demo' ),
),
array(
'id' => 'select_field',
'type' => 'select',
'title' => __( 'Select Field', 'redux-framework-demo' ),
'options' => array(
'1' => __( 'Option 1', 'redux-framework-demo' ),
'2' => __( 'Option 2', 'redux-framework-demo' ),
'3' => __( 'Option 3', 'redux-framework-demo' ),
),
'placeholder' => __( 'Listing Field', 'redux-framework-demo' ),
),
)
)
)
));
i have this custom Metabox field group from https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Field-Types#group containing 3 fields and displayed on the Products page template, i want to call the latest posts the client add to display them on my front-page. here is the code of the custom fields.
/**
* Repeatable Field Groups
*/
$meta_boxes['field_group'] = array(
'id' => 'field_group',
'title' => __( 'Manage your products here', 'cmb2' ),
'show_on' => array( 'id' => array( 11, ) ), // Specific post IDs to display this metabox
'object_types' => array( 'page', ),
'fields' => array(
array(
'id' => $prefix . 'repeat_group',
'type' => 'group',
'options' => array(
'group_title' => __( 'Product {#}', 'cmb2' ), // {#} gets replaced by row number
'add_button' => __( 'Add Another Product', 'cmb2' ),
'remove_button' => __( 'Remove Product', 'cmb2' ),
'sortable' => true, // beta
),
'fields' => array(
array(
'name' => 'Product Name',
'id' => 'product_name',
'type' => 'text',
),
array(
'name' => 'Product Description',
'description' => 'Write a short description for this Product',
'id' => 'product_description',
'type' => 'textarea',
),
array(
'name' => 'Product Image',
'id' => 'product_image',
'type' => 'file',
),
),
),
),
);
UPDATE:
i found this http://codex.wordpress.org/Function_Reference/wp_get_recent_posts but i still can't figure out how to make it get the posts from the custom fields