Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../themify/themify-...
File: example-functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Example of how Themify Metabox plugin can be used in themes and plugins.
[2] Fix | Delete
*
[3] Fix | Delete
* To use this file, enable the Themify Metabox plugin and then copy the contents of this file to
[4] Fix | Delete
* your theme's functions.php file, or "include" it.'
[5] Fix | Delete
*
[6] Fix | Delete
* @package Themify Metabox
[7] Fix | Delete
* @since 1.0
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
defined( 'ABSPATH' ) || exit;
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Register a custom meta box to display on Page post type
[14] Fix | Delete
*
[15] Fix | Delete
* @return array
[16] Fix | Delete
*/
[17] Fix | Delete
function themify_metabox_example_meta_box( $meta_boxes ) {
[18] Fix | Delete
$meta_boxes['tm-example'] = array(
[19] Fix | Delete
'id' => 'tm-example', // later, to add fields to this metabox we'll use "themify_metabox/fields/tm-example" filter hook, see function
[20] Fix | Delete
'title' => __( 'Themify Metabox Example', 'themify' ),
[21] Fix | Delete
'context' => 'normal',
[22] Fix | Delete
'priority' => 'high',
[23] Fix | Delete
'screen' => array( 'page' ),
[24] Fix | Delete
);
[25] Fix | Delete
[26] Fix | Delete
return $meta_boxes;
[27] Fix | Delete
}
[28] Fix | Delete
add_filter( 'themify_metaboxes', 'themify_metabox_example_meta_box' );
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Setup the custom fields for our Themify Metabox Example meta box, added earlier in the themify_metabox_example_meta_box function
[32] Fix | Delete
*
[33] Fix | Delete
* @return array
[34] Fix | Delete
*/
[35] Fix | Delete
function themify_metabox_example_meta_box_fields( $fields, $post_type ) {
[36] Fix | Delete
$first_tab_options = array(
[37] Fix | Delete
array(
[38] Fix | Delete
'name' => 'text_field',
[39] Fix | Delete
'title' => __( 'Text field', 'themify' ),
[40] Fix | Delete
'description' => __( 'Field description is displayed below the field.', 'themify' ),
[41] Fix | Delete
'type' => 'textbox',
[42] Fix | Delete
),
[43] Fix | Delete
array(
[44] Fix | Delete
'name' => 'textarea_field',
[45] Fix | Delete
'title' => __( 'Textarea field', 'themify' ),
[46] Fix | Delete
'type' => 'textarea',
[47] Fix | Delete
'size' => 55,
[48] Fix | Delete
'rows' => 4,
[49] Fix | Delete
),
[50] Fix | Delete
array(
[51] Fix | Delete
'name' => 'image_field',
[52] Fix | Delete
'title' => __( 'Image field', 'themify' ),
[53] Fix | Delete
'description' => '',
[54] Fix | Delete
'type' => 'image',
[55] Fix | Delete
'meta' => array()
[56] Fix | Delete
),
[57] Fix | Delete
array(
[58] Fix | Delete
'name' => 'dropdown_field',
[59] Fix | Delete
'title' => __( 'Dropdown', 'themify' ),
[60] Fix | Delete
'type' => 'dropdown',
[61] Fix | Delete
'meta' => array(
[62] Fix | Delete
array( 'value' => '', 'name' => '' ),
[63] Fix | Delete
array( 'value' => 'yes', 'name' => __( 'Yes', 'themify' ), 'selected' => true ),
[64] Fix | Delete
array( 'value' => 'no', 'name' => __( 'No', 'themify' ) ),
[65] Fix | Delete
),
[66] Fix | Delete
'description' => __( 'You can set which option is selected by default. Cool, eh?', 'themify' ),
[67] Fix | Delete
// do not save the custom field when the option is set to Yes
[68] Fix | Delete
'default' => 'yes',
[69] Fix | Delete
),
[70] Fix | Delete
array(
[71] Fix | Delete
'name' => 'checkbox_field',
[72] Fix | Delete
'title' => __( 'Checkbox', 'themify' ),
[73] Fix | Delete
'label' => __( 'Checkbox label', 'themify' ),
[74] Fix | Delete
'type' => 'checkbox',
[75] Fix | Delete
),
[76] Fix | Delete
array(
[77] Fix | Delete
'name' => 'radio_field',
[78] Fix | Delete
'title' => __( 'Radio field', 'themify' ),
[79] Fix | Delete
'description' => __( 'You can hide or show option based on how other options are configured', 'themify' ),
[80] Fix | Delete
'type' => 'radio',
[81] Fix | Delete
'meta' => array(
[82] Fix | Delete
array( 'value' => 'yes', 'name' => __( 'Yes', 'themify' ), 'selected' => true ),
[83] Fix | Delete
array( 'value' => 'no', 'name' => __( 'No', 'themify' ) ),
[84] Fix | Delete
),
[85] Fix | Delete
'enable_toggle' => true,
[86] Fix | Delete
'default' => 'yes',
[87] Fix | Delete
),
[88] Fix | Delete
array(
[89] Fix | Delete
'name' => 'separator_image_size',
[90] Fix | Delete
'type' => 'separator',
[91] Fix | Delete
//'description' => __( 'Optional text to show after the separator', 'themify'. )
[92] Fix | Delete
),
[93] Fix | Delete
array(
[94] Fix | Delete
'type' => 'multi',
[95] Fix | Delete
'name' => 'multi_field',
[96] Fix | Delete
'title' => __( 'Multi fields', 'themify' ),
[97] Fix | Delete
'meta' => array(
[98] Fix | Delete
'fields' => array(
[99] Fix | Delete
array(
[100] Fix | Delete
'name' => 'image_width',
[101] Fix | Delete
'label' => __( 'width', 'themify' ),
[102] Fix | Delete
'description' => '',
[103] Fix | Delete
'type' => 'textbox',
[104] Fix | Delete
'meta' => array( 'size' => 'small' )
[105] Fix | Delete
),
[106] Fix | Delete
// Image Height
[107] Fix | Delete
array(
[108] Fix | Delete
'name' => 'image_height',
[109] Fix | Delete
'label' => __( 'height', 'themify' ),
[110] Fix | Delete
'type' => 'textbox',
[111] Fix | Delete
'meta' => array( 'size' => 'small' )
[112] Fix | Delete
),
[113] Fix | Delete
),
[114] Fix | Delete
'description' => __( '"Multi" field type allows displaying multiple fields together.', 'themify'),
[115] Fix | Delete
'before' => '',
[116] Fix | Delete
'after' => '',
[117] Fix | Delete
'separator' => ''
[118] Fix | Delete
)
[119] Fix | Delete
),
[120] Fix | Delete
array(
[121] Fix | Delete
'name' => 'color_field',
[122] Fix | Delete
'title' => __( 'Color', 'themify' ),
[123] Fix | Delete
'description' => '',
[124] Fix | Delete
'type' => 'color',
[125] Fix | Delete
'meta' => array( 'default' => null ),
[126] Fix | Delete
'class' => 'yes-toggle'
[127] Fix | Delete
),
[128] Fix | Delete
array(
[129] Fix | Delete
'name' => 'post_id_info_field',
[130] Fix | Delete
'title' => __( 'Post ID', 'themify' ),
[131] Fix | Delete
'description' => __( 'This field type shows text with the ID of the post, which is: <code>%s</code>', 'themify' ),
[132] Fix | Delete
'type' => 'post_id_info',
[133] Fix | Delete
),
[134] Fix | Delete
);
[135] Fix | Delete
[136] Fix | Delete
$second_tab_options = array(
[137] Fix | Delete
array(
[138] Fix | Delete
'name' => 'audio_field',
[139] Fix | Delete
'title' => __( 'Audio field', 'themify' ),
[140] Fix | Delete
'description' => '',
[141] Fix | Delete
'type' => 'audio',
[142] Fix | Delete
'meta' => array(),
[143] Fix | Delete
),
[144] Fix | Delete
array(
[145] Fix | Delete
'name' => 'video_field',
[146] Fix | Delete
'title' => __( 'Video field', 'themify' ),
[147] Fix | Delete
'description' => '',
[148] Fix | Delete
'type' => 'video',
[149] Fix | Delete
'meta' => array(),
[150] Fix | Delete
),
[151] Fix | Delete
array(
[152] Fix | Delete
'name' => 'gallery_shortcode_field',
[153] Fix | Delete
'title' => __( 'Gallery Shortcode field', 'themify' ),
[154] Fix | Delete
'description' => __( 'Using this field type you can add a gallery manager.', 'themify' ),
[155] Fix | Delete
'type' => 'gallery_shortcode',
[156] Fix | Delete
),
[157] Fix | Delete
array(
[158] Fix | Delete
'name' => 'date_field',
[159] Fix | Delete
'title' => __( 'Date field', 'themify' ),
[160] Fix | Delete
'description' => '',
[161] Fix | Delete
'type' => 'date',
[162] Fix | Delete
'meta' => array(
[163] Fix | Delete
'default' => '',
[164] Fix | Delete
'pick' => __( 'Pick Date', 'themify' ),
[165] Fix | Delete
'close' => __( 'Done', 'themify' ),
[166] Fix | Delete
'clear' => __( 'Clear Date', 'themify' ),
[167] Fix | Delete
'time_format' => 'HH:mm:ss',
[168] Fix | Delete
'date_format' => 'yy-mm-dd',
[169] Fix | Delete
'timeseparator' => ' ',
[170] Fix | Delete
)
[171] Fix | Delete
),
[172] Fix | Delete
array(
[173] Fix | Delete
'name' => 'repeater_field',
[174] Fix | Delete
'title' => __( 'Repeater', 'themify' ),
[175] Fix | Delete
'type' => 'repeater',
[176] Fix | Delete
'fields' => array(
[177] Fix | Delete
array(
[178] Fix | Delete
'name' => 'text_1',
[179] Fix | Delete
'title' => __( 'Text Field', 'themify' ),
[180] Fix | Delete
'type' => 'textbox',
[181] Fix | Delete
'class' => 'small'
[182] Fix | Delete
),
[183] Fix | Delete
array(
[184] Fix | Delete
'name' => 'color_field',
[185] Fix | Delete
'title' => __( 'Color', 'themify' ),
[186] Fix | Delete
'description' => '',
[187] Fix | Delete
'type' => 'color',
[188] Fix | Delete
),
[189] Fix | Delete
array(
[190] Fix | Delete
'name' => 'field_3',
[191] Fix | Delete
'title' => __( 'Dropdown', 'themify' ),
[192] Fix | Delete
'type' => 'dropdown',
[193] Fix | Delete
'meta' => array(
[194] Fix | Delete
array( 'value' => 'yes', 'name' => __( 'Yes', 'themify' ) ),
[195] Fix | Delete
array( 'value' => 'no', 'name' => __( 'No', 'themify' ) ),
[196] Fix | Delete
),
[197] Fix | Delete
),
[198] Fix | Delete
),
[199] Fix | Delete
'add_new_label' => __( 'Add new item', 'themify' ),
[200] Fix | Delete
),
[201] Fix | Delete
);
[202] Fix | Delete
[203] Fix | Delete
$fields[] = array(
[204] Fix | Delete
'name' => __( 'First Tab', 'themify' ), // Name displayed in box
[205] Fix | Delete
'id' => 'first-tab',
[206] Fix | Delete
'options' => $first_tab_options,
[207] Fix | Delete
);
[208] Fix | Delete
$fields[] = array(
[209] Fix | Delete
'name' => __( 'Second Tab', 'themify' ), // Name displayed in box
[210] Fix | Delete
'id' => 'second-tab',
[211] Fix | Delete
'options' => $second_tab_options,
[212] Fix | Delete
);
[213] Fix | Delete
[214] Fix | Delete
return $fields;
[215] Fix | Delete
}
[216] Fix | Delete
add_filter( 'themify_metabox/fields/tm-example', 'themify_metabox_example_meta_box_fields', 10, 2 );
[217] Fix | Delete
[218] Fix | Delete
[219] Fix | Delete
/**
[220] Fix | Delete
* Add sample fields to the user profile screen
[221] Fix | Delete
*
[222] Fix | Delete
* @return array
[223] Fix | Delete
* @since 1.0.1
[224] Fix | Delete
*/
[225] Fix | Delete
function themify_metabox_example_user_fields( $fields ) {
[226] Fix | Delete
$fields['themify-metabox-sample'] = array(
[227] Fix | Delete
'title' => __( 'Sample fields added by Themify Metabox.', 'themify' ),
[228] Fix | Delete
'description' => __( 'Description text about the fields.', 'themify' ),
[229] Fix | Delete
'fields' => array(
[230] Fix | Delete
array(
[231] Fix | Delete
'name' => 'textbox_field',
[232] Fix | Delete
'title' => __( 'Text box', 'themify' ),
[233] Fix | Delete
'type' => 'textbox',
[234] Fix | Delete
),
[235] Fix | Delete
array(
[236] Fix | Delete
'name' => 'image_field',
[237] Fix | Delete
'title' => __( 'Image field', 'themify' ),
[238] Fix | Delete
'description' => __( 'This is only to show how field types can be used in user profile pages.', 'themify' ),
[239] Fix | Delete
'type' => 'image',
[240] Fix | Delete
),
[241] Fix | Delete
),
[242] Fix | Delete
);
[243] Fix | Delete
[244] Fix | Delete
return $fields;
[245] Fix | Delete
}
[246] Fix | Delete
add_filter( 'themify_metabox/user/fields', 'themify_metabox_example_user_fields' );
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Add a sample Color field to Category taxonomy
[250] Fix | Delete
*
[251] Fix | Delete
* @since 1.0.3
[252] Fix | Delete
* @return array
[253] Fix | Delete
*/
[254] Fix | Delete
function themify_metabox_example_category_fields( $fields ) {
[255] Fix | Delete
$new_fields = array(
[256] Fix | Delete
array(
[257] Fix | Delete
'name' => 'color_field',
[258] Fix | Delete
'title' => __( 'Color', 'themify' ),
[259] Fix | Delete
'description' => '',
[260] Fix | Delete
'type' => 'color',
[261] Fix | Delete
'meta' => array( 'default' => null ),
[262] Fix | Delete
),
[263] Fix | Delete
);
[264] Fix | Delete
[265] Fix | Delete
return array_merge( $fields, $new_fields );
[266] Fix | Delete
}
[267] Fix | Delete
add_filter( 'themify_metabox/taxonomy/category/fields', 'themify_metabox_example_category_fields', 10 );
[268] Fix | Delete
[269] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function