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/clone/wp-conte.../themes/Divi/includes/builder/feature
File: dynamic-content.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Gets the dynamic content fields related to Product post type.
[3] Fix | Delete
*
[4] Fix | Delete
* @since 3.29
[5] Fix | Delete
*
[6] Fix | Delete
* @return array
[7] Fix | Delete
*/
[8] Fix | Delete
function et_builder_get_product_dynamic_content_fields() {
[9] Fix | Delete
return array(
[10] Fix | Delete
'product_breadcrumb' => array(
[11] Fix | Delete
'label' => esc_html__( 'Product Breadcrumb', 'et_builder' ),
[12] Fix | Delete
'type' => 'text',
[13] Fix | Delete
),
[14] Fix | Delete
'product_price' => array(
[15] Fix | Delete
'label' => esc_html__( 'Product Price', 'et_builder' ),
[16] Fix | Delete
'type' => 'text',
[17] Fix | Delete
),
[18] Fix | Delete
'product_description' => array(
[19] Fix | Delete
'label' => esc_html__( 'Product Description', 'et_builder' ),
[20] Fix | Delete
'type' => 'text',
[21] Fix | Delete
),
[22] Fix | Delete
'product_short_description' => array(
[23] Fix | Delete
'label' => esc_html__( 'Product Short Description', 'et_builder' ),
[24] Fix | Delete
'type' => 'text',
[25] Fix | Delete
),
[26] Fix | Delete
'product_reviews_count' => array(
[27] Fix | Delete
'label' => esc_html__( 'Product Reviews Count', 'et_builder' ),
[28] Fix | Delete
'type' => 'text',
[29] Fix | Delete
),
[30] Fix | Delete
'product_sku' => array(
[31] Fix | Delete
'label' => esc_html__( 'Product SKU', 'et_builder' ),
[32] Fix | Delete
'type' => 'text',
[33] Fix | Delete
),
[34] Fix | Delete
'product_reviews' => array(
[35] Fix | Delete
'label' => esc_html__( 'Product Reviews', 'et_builder' ),
[36] Fix | Delete
'type' => 'text',
[37] Fix | Delete
),
[38] Fix | Delete
'product_additional_information' => array(
[39] Fix | Delete
'label' => esc_html__( 'Product Additional Information', 'et_builder' ),
[40] Fix | Delete
'type' => 'text',
[41] Fix | Delete
),
[42] Fix | Delete
'product_reviews_tab' => array(
[43] Fix | Delete
'label' => esc_html__( 'Product Reviews', 'et_builder' ),
[44] Fix | Delete
'type' => 'url',
[45] Fix | Delete
),
[46] Fix | Delete
);
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Get built-in dynamic content fields.
[51] Fix | Delete
*
[52] Fix | Delete
* @since 3.17.2
[53] Fix | Delete
*
[54] Fix | Delete
* @param integer $post_id
[55] Fix | Delete
*
[56] Fix | Delete
* @return array[]
[57] Fix | Delete
*/
[58] Fix | Delete
function et_builder_get_built_in_dynamic_content_fields( $post_id ) {
[59] Fix | Delete
$cache_key = 'et_builder_get_built_in_dynamic_content_fields';
[60] Fix | Delete
[61] Fix | Delete
if ( et_core_cache_has( $cache_key ) ) {
[62] Fix | Delete
return et_core_cache_get( $cache_key );
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
$post_type = get_post_type( $post_id );
[66] Fix | Delete
$post_type = $post_type ? $post_type : 'post';
[67] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[68] Fix | Delete
$post_type_label = $post_type_object->labels->singular_name;
[69] Fix | Delete
$post_taxonomy_types = et_builder_get_taxonomy_types( $post_type );
[70] Fix | Delete
$tag_taxonomy_post_type = $post_type;
[71] Fix | Delete
$fields = array();
[72] Fix | Delete
$before_after_field_types = array( 'text', 'any' );
[73] Fix | Delete
[74] Fix | Delete
if ( et_theme_builder_is_layout_post_type( $post_type ) ) {
[75] Fix | Delete
$post_type_label = esc_html__( 'Post', 'et_builder' );
[76] Fix | Delete
$tag_taxonomy_post_type = 'post';
[77] Fix | Delete
$public_post_types = array_keys( et_builder_get_public_post_types() );
[78] Fix | Delete
[79] Fix | Delete
foreach ( $public_post_types as $public_post_type ) {
[80] Fix | Delete
$post_taxonomy_types = array_merge(
[81] Fix | Delete
$post_taxonomy_types,
[82] Fix | Delete
et_builder_get_taxonomy_types( $public_post_type )
[83] Fix | Delete
);
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
$default_category_type = 'post' === $post_type ? 'category' : "${post_type}_category";
[88] Fix | Delete
[89] Fix | Delete
if ( ! isset( $post_taxonomy_types[ $default_category_type ] ) ) {
[90] Fix | Delete
$default_category_type = 'category';
[91] Fix | Delete
[92] Fix | Delete
if ( ! empty( $post_taxonomy_types ) ) {
[93] Fix | Delete
// Use the 1st available taxonomy as the default value.
[94] Fix | Delete
$default_category_type = array_keys( $post_taxonomy_types );
[95] Fix | Delete
$default_category_type = $default_category_type[0];
[96] Fix | Delete
}
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
$date_format_options = array(
[100] Fix | Delete
'default' => et_builder_i18n( 'Default' ),
[101] Fix | Delete
'M j, Y' => esc_html__( 'Aug 6, 1999 (M j, Y)', 'et_builder' ),
[102] Fix | Delete
'F d, Y' => esc_html__( 'August 06, 1999 (F d, Y)', 'et_builder' ),
[103] Fix | Delete
'm/d/Y' => esc_html__( '08/06/1999 (m/d/Y)', 'et_builder' ),
[104] Fix | Delete
'm.d.Y' => esc_html__( '08.06.1999 (m.d.Y)', 'et_builder' ),
[105] Fix | Delete
'j M, Y' => esc_html__( '6 Aug, 1999 (j M, Y)', 'et_builder' ),
[106] Fix | Delete
'l, M d' => esc_html__( 'Tuesday, Aug 06 (l, M d)', 'et_builder' ),
[107] Fix | Delete
'custom' => esc_html__( 'Custom', 'et_builder' ),
[108] Fix | Delete
);
[109] Fix | Delete
[110] Fix | Delete
$fields['post_title'] = array(
[111] Fix | Delete
// Translators: %1$s: Post type name
[112] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s/Archive Title', 'et_builder' ), $post_type_label ) ),
[113] Fix | Delete
'type' => 'text',
[114] Fix | Delete
);
[115] Fix | Delete
[116] Fix | Delete
$fields['post_excerpt'] = array(
[117] Fix | Delete
// Translators: %1$s: Post type name
[118] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Excerpt', 'et_builder' ), $post_type_label ) ),
[119] Fix | Delete
'type' => 'text',
[120] Fix | Delete
'fields' => array(
[121] Fix | Delete
'words' => array(
[122] Fix | Delete
'label' => esc_html__( 'Number of Words', 'et_builder' ),
[123] Fix | Delete
'type' => 'text',
[124] Fix | Delete
'default' => '',
[125] Fix | Delete
),
[126] Fix | Delete
'read_more_label' => array(
[127] Fix | Delete
'label' => esc_html__( 'Read More Text', 'et_builder' ),
[128] Fix | Delete
'type' => 'text',
[129] Fix | Delete
'default' => '',
[130] Fix | Delete
),
[131] Fix | Delete
),
[132] Fix | Delete
);
[133] Fix | Delete
[134] Fix | Delete
$fields['post_date'] = array(
[135] Fix | Delete
// Translators: %1$s: Post type name
[136] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Publish Date', 'et_builder' ), $post_type_label ) ),
[137] Fix | Delete
'type' => 'text',
[138] Fix | Delete
'fields' => array(
[139] Fix | Delete
'date_format' => array(
[140] Fix | Delete
'label' => esc_html__( 'Date Format', 'et_builder' ),
[141] Fix | Delete
'type' => 'select',
[142] Fix | Delete
'options' => $date_format_options,
[143] Fix | Delete
'default' => 'default',
[144] Fix | Delete
),
[145] Fix | Delete
'custom_date_format' => array(
[146] Fix | Delete
'label' => esc_html__( 'Custom Date Format', 'et_builder' ),
[147] Fix | Delete
'type' => 'text',
[148] Fix | Delete
'default' => '',
[149] Fix | Delete
'show_if' => array(
[150] Fix | Delete
'date_format' => 'custom',
[151] Fix | Delete
),
[152] Fix | Delete
),
[153] Fix | Delete
),
[154] Fix | Delete
);
[155] Fix | Delete
[156] Fix | Delete
$fields['post_comment_count'] = array(
[157] Fix | Delete
// Translators: %1$s: Post type name
[158] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Comment Count', 'et_builder' ), $post_type_label ) ),
[159] Fix | Delete
'type' => 'text',
[160] Fix | Delete
'fields' => array(
[161] Fix | Delete
'link_to_comments_page' => array(
[162] Fix | Delete
'label' => esc_html__( 'Link to Comments Area', 'et_builder' ),
[163] Fix | Delete
'type' => 'yes_no_button',
[164] Fix | Delete
'options' => array(
[165] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[166] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[167] Fix | Delete
),
[168] Fix | Delete
'default' => 'on',
[169] Fix | Delete
),
[170] Fix | Delete
),
[171] Fix | Delete
);
[172] Fix | Delete
[173] Fix | Delete
if ( ! empty( $post_taxonomy_types ) ) {
[174] Fix | Delete
$fields['post_categories'] = array(
[175] Fix | Delete
// Translators: %1$s: Post type name
[176] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Categories', 'et_builder' ), $post_type_label ) ),
[177] Fix | Delete
'type' => 'text',
[178] Fix | Delete
'fields' => array(
[179] Fix | Delete
'link_to_term_page' => array(
[180] Fix | Delete
'label' => esc_html__( 'Link to Category Index Pages', 'et_builder' ),
[181] Fix | Delete
'type' => 'yes_no_button',
[182] Fix | Delete
'options' => array(
[183] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[184] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[185] Fix | Delete
),
[186] Fix | Delete
'default' => 'on',
[187] Fix | Delete
),
[188] Fix | Delete
'separator' => array(
[189] Fix | Delete
'label' => esc_html__( 'Categories Separator', 'et_builder' ),
[190] Fix | Delete
'type' => 'text',
[191] Fix | Delete
'default' => ' | ',
[192] Fix | Delete
),
[193] Fix | Delete
'category_type' => array(
[194] Fix | Delete
'label' => esc_html__( 'Category Type', 'et_builder' ),
[195] Fix | Delete
'type' => 'select',
[196] Fix | Delete
'options' => $post_taxonomy_types,
[197] Fix | Delete
'default' => $default_category_type,
[198] Fix | Delete
),
[199] Fix | Delete
),
[200] Fix | Delete
);
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
// Fill in tag taxonomies.
[204] Fix | Delete
if ( isset( $post_taxonomy_types["{$tag_taxonomy_post_type}_tag"] ) ) {
[205] Fix | Delete
$fields['post_tags'] = array(
[206] Fix | Delete
// Translators: %1$s: Post type name
[207] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Tags', 'et_builder' ), $post_type_label ) ),
[208] Fix | Delete
'type' => 'text',
[209] Fix | Delete
'fields' => array(
[210] Fix | Delete
'link_to_term_page' => array(
[211] Fix | Delete
'label' => esc_html__( 'Link to Tag Index Pages', 'et_builder' ),
[212] Fix | Delete
'type' => 'yes_no_button',
[213] Fix | Delete
'options' => array(
[214] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[215] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[216] Fix | Delete
),
[217] Fix | Delete
'default' => 'on',
[218] Fix | Delete
),
[219] Fix | Delete
'separator' => array(
[220] Fix | Delete
'label' => esc_html__( 'Tags Separator', 'et_builder' ),
[221] Fix | Delete
'type' => 'text',
[222] Fix | Delete
'default' => ' | ',
[223] Fix | Delete
),
[224] Fix | Delete
'category_type' => array(
[225] Fix | Delete
'label' => esc_html__( 'Category Type', 'et_builder' ),
[226] Fix | Delete
'type' => 'select',
[227] Fix | Delete
'options' => $post_taxonomy_types,
[228] Fix | Delete
'default' => "{$tag_taxonomy_post_type}_tag",
[229] Fix | Delete
),
[230] Fix | Delete
),
[231] Fix | Delete
);
[232] Fix | Delete
}
[233] Fix | Delete
[234] Fix | Delete
$fields['post_link'] = array(
[235] Fix | Delete
// Translators: %1$s: Post type name
[236] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Link', 'et_builder' ), $post_type_label ) ),
[237] Fix | Delete
'type' => 'text',
[238] Fix | Delete
'fields' => array(
[239] Fix | Delete
'text' => array(
[240] Fix | Delete
'label' => esc_html__( 'Link Text', 'et_builder' ),
[241] Fix | Delete
'type' => 'select',
[242] Fix | Delete
'options' => array(
[243] Fix | Delete
// Translators: %1$s: Post type name
[244] Fix | Delete
'post_title' => esc_html( sprintf( __( '%1$s Title', 'et_builder' ), $post_type_label ) ),
[245] Fix | Delete
'custom' => esc_html__( 'Custom', 'et_builder' ),
[246] Fix | Delete
),
[247] Fix | Delete
'default' => 'post_title',
[248] Fix | Delete
),
[249] Fix | Delete
'custom_text' => array(
[250] Fix | Delete
'label' => esc_html__( 'Custom Link Text', 'et_builder' ),
[251] Fix | Delete
'type' => 'text',
[252] Fix | Delete
'default' => '',
[253] Fix | Delete
'show_if' => array(
[254] Fix | Delete
'text' => 'custom',
[255] Fix | Delete
),
[256] Fix | Delete
),
[257] Fix | Delete
),
[258] Fix | Delete
);
[259] Fix | Delete
[260] Fix | Delete
$fields['post_author'] = array(
[261] Fix | Delete
// Translators: %1$s: Post type name
[262] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Author', 'et_builder' ), $post_type_label ) ),
[263] Fix | Delete
'type' => 'text',
[264] Fix | Delete
'fields' => array(
[265] Fix | Delete
'name_format' => array(
[266] Fix | Delete
'label' => esc_html__( 'Name Format', 'et_builder' ),
[267] Fix | Delete
'type' => 'select',
[268] Fix | Delete
'options' => array(
[269] Fix | Delete
'display_name' => esc_html__( 'Public Display Name', 'et_builder' ),
[270] Fix | Delete
'first_last_name' => esc_html__( 'First & Last Name', 'et_builder' ),
[271] Fix | Delete
'last_first_name' => esc_html__( 'Last, First Name', 'et_builder' ),
[272] Fix | Delete
'first_name' => esc_html__( 'First Name', 'et_builder' ),
[273] Fix | Delete
'last_name' => esc_html__( 'Last Name', 'et_builder' ),
[274] Fix | Delete
'nickname' => esc_html__( 'Nickname', 'et_builder' ),
[275] Fix | Delete
'username' => esc_html__( 'Username', 'et_builder' ),
[276] Fix | Delete
),
[277] Fix | Delete
'default' => 'display_name',
[278] Fix | Delete
),
[279] Fix | Delete
'link' => array(
[280] Fix | Delete
'label' => esc_html__( 'Link Name', 'et_builder' ),
[281] Fix | Delete
'type' => 'yes_no_button',
[282] Fix | Delete
'options' => array(
[283] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[284] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[285] Fix | Delete
),
[286] Fix | Delete
'default' => 'off',
[287] Fix | Delete
),
[288] Fix | Delete
'link_destination' => array(
[289] Fix | Delete
'label' => esc_html__( 'Link Destination', 'et_builder' ),
[290] Fix | Delete
'type' => 'select',
[291] Fix | Delete
'options' => array(
[292] Fix | Delete
'author_archive' => esc_html__( 'Author Archive Page', 'et_builder' ),
[293] Fix | Delete
'author_website' => esc_html__( 'Author Website', 'et_builder' ),
[294] Fix | Delete
),
[295] Fix | Delete
'default' => 'author_archive',
[296] Fix | Delete
'show_if' => array(
[297] Fix | Delete
'link' => 'on',
[298] Fix | Delete
),
[299] Fix | Delete
),
[300] Fix | Delete
),
[301] Fix | Delete
);
[302] Fix | Delete
[303] Fix | Delete
$fields['post_author_bio'] = array(
[304] Fix | Delete
'label' => esc_html__( 'Author Bio', 'et_builder' ),
[305] Fix | Delete
'type' => 'text',
[306] Fix | Delete
);
[307] Fix | Delete
[308] Fix | Delete
if ( et_builder_tb_enabled() ) {
[309] Fix | Delete
$fields['term_description'] = array(
[310] Fix | Delete
'label' => esc_html__( 'Category Description', 'et_builder' ),
[311] Fix | Delete
'type' => 'text',
[312] Fix | Delete
);
[313] Fix | Delete
}
[314] Fix | Delete
[315] Fix | Delete
$fields['site_title'] = array(
[316] Fix | Delete
'label' => esc_html__( 'Site Title', 'et_builder' ),
[317] Fix | Delete
'type' => 'text',
[318] Fix | Delete
);
[319] Fix | Delete
[320] Fix | Delete
$fields['site_tagline'] = array(
[321] Fix | Delete
'label' => esc_html__( 'Site Tagline', 'et_builder' ),
[322] Fix | Delete
'type' => 'text',
[323] Fix | Delete
);
[324] Fix | Delete
[325] Fix | Delete
$fields['current_date'] = array(
[326] Fix | Delete
'label' => esc_html__( 'Current Date', 'et_builder' ),
[327] Fix | Delete
'type' => 'text',
[328] Fix | Delete
'fields' => array(
[329] Fix | Delete
'date_format' => array(
[330] Fix | Delete
'label' => esc_html__( 'Date Format', 'et_builder' ),
[331] Fix | Delete
'type' => 'select',
[332] Fix | Delete
'options' => $date_format_options,
[333] Fix | Delete
'default' => 'default',
[334] Fix | Delete
),
[335] Fix | Delete
'custom_date_format' => array(
[336] Fix | Delete
'label' => esc_html__( 'Custom Date Format', 'et_builder' ),
[337] Fix | Delete
'type' => 'text',
[338] Fix | Delete
'default' => '',
[339] Fix | Delete
'show_if' => array(
[340] Fix | Delete
'date_format' => 'custom',
[341] Fix | Delete
),
[342] Fix | Delete
),
[343] Fix | Delete
),
[344] Fix | Delete
);
[345] Fix | Delete
[346] Fix | Delete
$fields['post_link_url'] = array(
[347] Fix | Delete
// Translators: %1$s: Post type name
[348] Fix | Delete
'label' => esc_html( sprintf( __( 'Current %1$s Link', 'et_builder' ), $post_type_label ) ),
[349] Fix | Delete
'type' => 'url',
[350] Fix | Delete
);
[351] Fix | Delete
[352] Fix | Delete
$fields['post_author_url'] = array(
[353] Fix | Delete
'label' => esc_html__( 'Author Page Link', 'et_builder' ),
[354] Fix | Delete
'type' => 'url',
[355] Fix | Delete
);
[356] Fix | Delete
[357] Fix | Delete
$fields['home_url'] = array(
[358] Fix | Delete
'label' => esc_html__( 'Homepage Link', 'et_builder' ),
[359] Fix | Delete
'type' => 'url',
[360] Fix | Delete
);
[361] Fix | Delete
[362] Fix | Delete
// Fill in post type URL options.
[363] Fix | Delete
$post_types = et_builder_get_public_post_types();
[364] Fix | Delete
foreach ( $post_types as $public_post_type ) {
[365] Fix | Delete
$public_post_type_label = $public_post_type->labels->singular_name;
[366] Fix | Delete
$key = 'post_link_url_' . $public_post_type->name;
[367] Fix | Delete
[368] Fix | Delete
$fields[ $key ] = array(
[369] Fix | Delete
// Translators: %1$s: Post type name
[370] Fix | Delete
'label' => esc_html( sprintf( __( '%1$s Link', 'et_builder' ), $public_post_type_label ) ),
[371] Fix | Delete
'type' => 'url',
[372] Fix | Delete
'fields' => array(
[373] Fix | Delete
'post_id' => array(
[374] Fix | Delete
'label' => $public_post_type_label,
[375] Fix | Delete
'type' => 'select_post',
[376] Fix | Delete
'post_type' => $public_post_type->name,
[377] Fix | Delete
'default' => '',
[378] Fix | Delete
),
[379] Fix | Delete
),
[380] Fix | Delete
);
[381] Fix | Delete
}
[382] Fix | Delete
[383] Fix | Delete
$fields['post_featured_image'] = array(
[384] Fix | Delete
'label' => esc_html__( 'Featured Image', 'et_builder' ),
[385] Fix | Delete
'type' => 'image',
[386] Fix | Delete
);
[387] Fix | Delete
[388] Fix | Delete
$fields['post_author_profile_picture'] = array(
[389] Fix | Delete
// Translators: %1$s: Post type name
[390] Fix | Delete
'label' => esc_html__( 'Author Profile Picture', 'et_builder' ),
[391] Fix | Delete
'type' => 'image',
[392] Fix | Delete
);
[393] Fix | Delete
[394] Fix | Delete
$fields['site_logo'] = array(
[395] Fix | Delete
'label' => esc_html__( 'Site Logo', 'et_builder' ),
[396] Fix | Delete
'type' => 'image',
[397] Fix | Delete
);
[398] Fix | Delete
[399] Fix | Delete
if ( et_builder_tb_enabled() ) {
[400] Fix | Delete
$fields['post_meta_key'] = array(
[401] Fix | Delete
'label' => esc_html__( 'Manual Custom Field Name', 'et_builder' ),
[402] Fix | Delete
'type' => 'any',
[403] Fix | Delete
'group' => esc_html__( 'Custom Fields', 'et_builder' ),
[404] Fix | Delete
'fields' => array(
[405] Fix | Delete
'meta_key' => array(
[406] Fix | Delete
'label' => esc_html__( 'Field Name', 'et_builder' ),
[407] Fix | Delete
'type' => 'text',
[408] Fix | Delete
),
[409] Fix | Delete
),
[410] Fix | Delete
);
[411] Fix | Delete
[412] Fix | Delete
if ( current_user_can( 'unfiltered_html' ) ) {
[413] Fix | Delete
$fields['post_meta_key']['fields']['enable_html'] = array(
[414] Fix | Delete
'label' => esc_html__( 'Enable raw HTML', 'et_builder' ),
[415] Fix | Delete
'type' => 'yes_no_button',
[416] Fix | Delete
'options' => array(
[417] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[418] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[419] Fix | Delete
),
[420] Fix | Delete
'default' => 'off',
[421] Fix | Delete
'show_on' => 'text',
[422] Fix | Delete
);
[423] Fix | Delete
}
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
/*
[427] Fix | Delete
* Include Product dynamic fields on Product post type.
[428] Fix | Delete
*
[429] Fix | Delete
* This is enforced based on the discussion at
[430] Fix | Delete
*
[431] Fix | Delete
* @see https://github.com/elegantthemes/Divi/issues/15921#issuecomment-512707471
[432] Fix | Delete
*/
[433] Fix | Delete
if ( et_is_woocommerce_plugin_active() && ( 'product' === $post_type || et_theme_builder_is_layout_post_type( $post_type ) ) ) {
[434] Fix | Delete
$fields = array_merge( $fields, et_builder_get_product_dynamic_content_fields() );
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
// Fill in boilerplate.
[438] Fix | Delete
foreach ( $fields as $key => $field ) {
[439] Fix | Delete
$fields[ $key ]['custom'] = false;
[440] Fix | Delete
$fields[ $key ]['group'] = et_()->array_get( $fields, "{$key}.group", 'Default' );
[441] Fix | Delete
[442] Fix | Delete
if ( in_array( $field['type'], $before_after_field_types, true ) ) {
[443] Fix | Delete
$settings = isset( $field['fields'] ) ? $field['fields'] : array();
[444] Fix | Delete
$settings = array_merge( array(
[445] Fix | Delete
'before' => array(
[446] Fix | Delete
'label' => et_builder_i18n( 'Before' ),
[447] Fix | Delete
'type' => 'text',
[448] Fix | Delete
'default' => '',
[449] Fix | Delete
),
[450] Fix | Delete
'after' => array(
[451] Fix | Delete
'label' => et_builder_i18n( 'After' ),
[452] Fix | Delete
'type' => 'text',
[453] Fix | Delete
'default' => '',
[454] Fix | Delete
),
[455] Fix | Delete
), $settings );
[456] Fix | Delete
[457] Fix | Delete
$fields[ $key ]['fields'] = $settings;
[458] Fix | Delete
}
[459] Fix | Delete
}
[460] Fix | Delete
[461] Fix | Delete
et_core_cache_add( $cache_key, $fields );
[462] Fix | Delete
[463] Fix | Delete
return $fields;
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
/**
[467] Fix | Delete
* Clear dynamic content fields cache whenever a custom post type is registered.
[468] Fix | Delete
*
[469] Fix | Delete
* @since 3.26.7
[470] Fix | Delete
*
[471] Fix | Delete
* @return void
[472] Fix | Delete
*/
[473] Fix | Delete
function et_builder_clear_get_built_in_dynamic_content_fields_cache() {
[474] Fix | Delete
et_core_cache_delete( 'et_builder_get_built_in_dynamic_content_fields' );
[475] Fix | Delete
}
[476] Fix | Delete
add_action( 'registered_post_type', 'et_builder_clear_get_built_in_dynamic_content_fields_cache' );
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* Get all public taxonomies associated with a given post type.
[480] Fix | Delete
*
[481] Fix | Delete
* @since 3.17.2
[482] Fix | Delete
*
[483] Fix | Delete
* @param string $post_type
[484] Fix | Delete
*
[485] Fix | Delete
* @return array
[486] Fix | Delete
*/
[487] Fix | Delete
function et_builder_get_taxonomy_types( $post_type ) {
[488] Fix | Delete
$taxonomies = get_object_taxonomies( $post_type, 'object' );
[489] Fix | Delete
$list = array();
[490] Fix | Delete
[491] Fix | Delete
if ( empty( $taxonomies ) ) {
[492] Fix | Delete
return $list;
[493] Fix | Delete
}
[494] Fix | Delete
[495] Fix | Delete
foreach ( $taxonomies as $taxonomy ) {
[496] Fix | Delete
if ( ! empty( $taxonomy ) && $taxonomy->public && $taxonomy->show_ui ) {
[497] Fix | Delete
$list[ $taxonomy->name ] = $taxonomy->label;
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function