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/module
File: Portfolio.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Portfolio', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Portfolios', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_portfolio';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
[8] Fix | Delete
$this->main_css_element = '%%order_class%% .et_pb_portfolio_item';
[9] Fix | Delete
[10] Fix | Delete
$this->settings_modal_toggles = array(
[11] Fix | Delete
'general' => array(
[12] Fix | Delete
'toggles' => array(
[13] Fix | Delete
'main_content' => et_builder_i18n( 'Content' ),
[14] Fix | Delete
'elements' => et_builder_i18n( 'Elements' ),
[15] Fix | Delete
),
[16] Fix | Delete
),
[17] Fix | Delete
'advanced' => array(
[18] Fix | Delete
'toggles' => array(
[19] Fix | Delete
'layout' => et_builder_i18n( 'Layout' ),
[20] Fix | Delete
'overlay' => et_builder_i18n( 'Overlay' ),
[21] Fix | Delete
'image' => array(
[22] Fix | Delete
'title' => et_builder_i18n( 'Image' ),
[23] Fix | Delete
),
[24] Fix | Delete
'text' => array(
[25] Fix | Delete
'title' => et_builder_i18n( 'Text' ),
[26] Fix | Delete
'priority' => 49,
[27] Fix | Delete
),
[28] Fix | Delete
),
[29] Fix | Delete
),
[30] Fix | Delete
);
[31] Fix | Delete
[32] Fix | Delete
$this->advanced_fields = array(
[33] Fix | Delete
'fonts' => array(
[34] Fix | Delete
'title' => array(
[35] Fix | Delete
'label' => et_builder_i18n( 'Title' ),
[36] Fix | Delete
'css' => array(
[37] Fix | Delete
'main' => "{$this->main_css_element} h2, {$this->main_css_element} h2 a, {$this->main_css_element} h1.et_pb_module_header, {$this->main_css_element} h1.et_pb_module_header a, {$this->main_css_element} h3.et_pb_module_header, {$this->main_css_element} h3.et_pb_module_header a, {$this->main_css_element} h4.et_pb_module_header, {$this->main_css_element} h4.et_pb_module_header a, {$this->main_css_element} h5.et_pb_module_header, {$this->main_css_element} h5.et_pb_module_header a, {$this->main_css_element} h6.et_pb_module_header, {$this->main_css_element} h6.et_pb_module_header a",
[38] Fix | Delete
'important' => 'all',
[39] Fix | Delete
'hover' => "{$this->main_css_element} h2:hover, {$this->main_css_element} h2:hover a, {$this->main_css_element} h1.et_pb_module_header:hover, {$this->main_css_element} h1.et_pb_module_header:hover a, {$this->main_css_element} h3.et_pb_module_header:hover, {$this->main_css_element} h3.et_pb_module_header:hover a, {$this->main_css_element} h4.et_pb_module_header:hover, {$this->main_css_element} h4.et_pb_module_header:hover a, {$this->main_css_element} h5.et_pb_module_header:hover, {$this->main_css_element} h5.et_pb_module_header:hover a, {$this->main_css_element} h6.et_pb_module_header:hover, {$this->main_css_element} h6.et_pb_module_header:hover a",
[40] Fix | Delete
),
[41] Fix | Delete
'header_level' => array(
[42] Fix | Delete
'default' => 'h2',
[43] Fix | Delete
),
[44] Fix | Delete
),
[45] Fix | Delete
'caption' => array(
[46] Fix | Delete
'label' => esc_html__( 'Meta', 'et_builder' ),
[47] Fix | Delete
'css' => array(
[48] Fix | Delete
'main' => "{$this->main_css_element} .post-meta, {$this->main_css_element} .post-meta a",
[49] Fix | Delete
'hover' => "{$this->main_css_element} .post-meta a:hover",
[50] Fix | Delete
),
[51] Fix | Delete
),
[52] Fix | Delete
'pagination' => array(
[53] Fix | Delete
'label' => esc_html__( 'Pagination', 'et_builder' ),
[54] Fix | Delete
'css' => array(
[55] Fix | Delete
'main' => function_exists( 'wp_pagenavi' ) ? "%%order_class%% .wp-pagenavi a, %%order_class%% .wp-pagenavi span" : "%%order_class%% .pagination a",
[56] Fix | Delete
'important' => function_exists( 'wp_pagenavi' ) ? 'all' : array(),
[57] Fix | Delete
'text_align' => '%%order_class%% .wp-pagenavi',
[58] Fix | Delete
'hover' => function_exists( 'wp_pagenavi' ) ? "%%order_class%% .wp-pagenavi a:hover, %%order_class%% .wp-pagenavi span:hover" : "%%order_class%% .pagination a:hover",
[59] Fix | Delete
),
[60] Fix | Delete
'hide_text_align' => ! function_exists( 'wp_pagenavi' ),
[61] Fix | Delete
'text_align' => array(
[62] Fix | Delete
'options' => et_builder_get_text_orientation_options( array( 'justified' ), array() ),
[63] Fix | Delete
),
[64] Fix | Delete
),
[65] Fix | Delete
),
[66] Fix | Delete
'background' => array(
[67] Fix | Delete
'settings' => array(
[68] Fix | Delete
'color' => 'alpha',
[69] Fix | Delete
),
[70] Fix | Delete
),
[71] Fix | Delete
'borders' => array(
[72] Fix | Delete
'default' => array(
[73] Fix | Delete
'css' => array(
[74] Fix | Delete
'main' => array(
[75] Fix | Delete
'border_radii' => $this->main_css_element,
[76] Fix | Delete
'border_styles' => $this->main_css_element,
[77] Fix | Delete
),
[78] Fix | Delete
),
[79] Fix | Delete
),
[80] Fix | Delete
'image' => array(
[81] Fix | Delete
'css' => array(
[82] Fix | Delete
'main' => array(
[83] Fix | Delete
'border_radii' => "{$this->main_css_element} .et_portfolio_image",
[84] Fix | Delete
'border_styles' => "{$this->main_css_element} .et_portfolio_image",
[85] Fix | Delete
)
[86] Fix | Delete
),
[87] Fix | Delete
'label_prefix' => et_builder_i18n( 'Image' ),
[88] Fix | Delete
'tab_slug' => 'advanced',
[89] Fix | Delete
'toggle_slug' => 'image',
[90] Fix | Delete
),
[91] Fix | Delete
),
[92] Fix | Delete
'box_shadow' => array(
[93] Fix | Delete
'default' => array(
[94] Fix | Delete
'css' => array(
[95] Fix | Delete
'overlay' => false,
[96] Fix | Delete
)
[97] Fix | Delete
),
[98] Fix | Delete
'image' => array(
[99] Fix | Delete
'label' => esc_html__( 'Image Box Shadow', 'et_builder' ),
[100] Fix | Delete
'option_category' => 'layout',
[101] Fix | Delete
'tab_slug' => 'advanced',
[102] Fix | Delete
'toggle_slug' => 'image',
[103] Fix | Delete
'css' => array(
[104] Fix | Delete
'main' => '%%order_class%% .et_pb_portfolio_item .et_portfolio_image',
[105] Fix | Delete
'overlay' => 'inset',
[106] Fix | Delete
),
[107] Fix | Delete
'default_on_fronts' => array(
[108] Fix | Delete
'color' => '',
[109] Fix | Delete
'position' => '',
[110] Fix | Delete
),
[111] Fix | Delete
),
[112] Fix | Delete
),
[113] Fix | Delete
'margin_padding' => array(
[114] Fix | Delete
'css' => array(
[115] Fix | Delete
'main' => '%%order_class%%',
[116] Fix | Delete
'important' => array( 'custom_margin' ), // needed to overwrite last module margin-bottom styling
[117] Fix | Delete
),
[118] Fix | Delete
),
[119] Fix | Delete
'text' => array(
[120] Fix | Delete
'use_background_layout' => true,
[121] Fix | Delete
'options' => array(
[122] Fix | Delete
'background_layout' => array(
[123] Fix | Delete
'default' => 'light',
[124] Fix | Delete
'hover' => 'tabs',
[125] Fix | Delete
),
[126] Fix | Delete
),
[127] Fix | Delete
'css' => array(
[128] Fix | Delete
'main' => '%%order_class%% .et_pb_module_header, %%order_class%% .post-meta'
[129] Fix | Delete
)
[130] Fix | Delete
),
[131] Fix | Delete
'filters' => array(
[132] Fix | Delete
'css' => array(
[133] Fix | Delete
'main' => '%%order_class%%',
[134] Fix | Delete
),
[135] Fix | Delete
'child_filters_target' => array(
[136] Fix | Delete
'tab_slug' => 'advanced',
[137] Fix | Delete
'toggle_slug' => 'image',
[138] Fix | Delete
),
[139] Fix | Delete
),
[140] Fix | Delete
'image' => array(
[141] Fix | Delete
'css' => array(
[142] Fix | Delete
'main' => '%%order_class%% .et_portfolio_image',
[143] Fix | Delete
),
[144] Fix | Delete
),
[145] Fix | Delete
'scroll_effects' => array(
[146] Fix | Delete
'grid_support' => 'yes',
[147] Fix | Delete
),
[148] Fix | Delete
'button' => false,
[149] Fix | Delete
);
[150] Fix | Delete
[151] Fix | Delete
$this->custom_css_fields = array(
[152] Fix | Delete
'portfolio_image' => array(
[153] Fix | Delete
'label' => esc_html__( 'Portfolio Image', 'et_builder' ),
[154] Fix | Delete
'selector' => '.et_portfolio_image',
[155] Fix | Delete
),
[156] Fix | Delete
'overlay' => array(
[157] Fix | Delete
'label' => et_builder_i18n( 'Overlay' ),
[158] Fix | Delete
'selector' => '.et_overlay',
[159] Fix | Delete
),
[160] Fix | Delete
'overlay_icon' => array(
[161] Fix | Delete
'label' => esc_html__( 'Overlay Icon', 'et_builder' ),
[162] Fix | Delete
'selector' => '.et_overlay:before',
[163] Fix | Delete
),
[164] Fix | Delete
'portfolio_title' => array(
[165] Fix | Delete
'label' => esc_html__( 'Portfolio Title', 'et_builder' ),
[166] Fix | Delete
'selector' => '.et_pb_portfolio_item h2',
[167] Fix | Delete
),
[168] Fix | Delete
'portfolio_post_meta' => array(
[169] Fix | Delete
'label' => esc_html__( 'Portfolio Post Meta', 'et_builder' ),
[170] Fix | Delete
'selector' => '.et_pb_portfolio_item .post-meta',
[171] Fix | Delete
),
[172] Fix | Delete
'pagination' => array(
[173] Fix | Delete
'label' => esc_html__( 'Portfolio Pagination', 'et_builder' ),
[174] Fix | Delete
'selector' => function_exists( 'wp_pagenavi' ) ? '%%order_class%% .wp-pagenavi a, %%order_class%% .wp-pagenavi span' : '%%order_class%% .pagination a',
[175] Fix | Delete
),
[176] Fix | Delete
);
[177] Fix | Delete
[178] Fix | Delete
$this->help_videos = array(
[179] Fix | Delete
array(
[180] Fix | Delete
'id' => '6NpHdiLciDU',
[181] Fix | Delete
'name' => esc_html__( 'An introduction to the Portfolio module', 'et_builder' ),
[182] Fix | Delete
),
[183] Fix | Delete
);
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
function get_fields() {
[187] Fix | Delete
$fields = array(
[188] Fix | Delete
'fullwidth' => array(
[189] Fix | Delete
'label' => et_builder_i18n( 'Layout' ),
[190] Fix | Delete
'type' => 'select',
[191] Fix | Delete
'option_category' => 'layout',
[192] Fix | Delete
'options' => array(
[193] Fix | Delete
'on' => esc_html__( 'Fullwidth', 'et_builder' ),
[194] Fix | Delete
'off' => esc_html__( 'Grid', 'et_builder' ),
[195] Fix | Delete
),
[196] Fix | Delete
'default_on_front' => 'on',
[197] Fix | Delete
'affects' => array(
[198] Fix | Delete
'hover_icon',
[199] Fix | Delete
'zoom_icon_color',
[200] Fix | Delete
'hover_overlay_color',
[201] Fix | Delete
),
[202] Fix | Delete
'description' => esc_html__( 'Choose your desired portfolio layout style.', 'et_builder' ),
[203] Fix | Delete
'computed_affects' => array(
[204] Fix | Delete
'__projects',
[205] Fix | Delete
),
[206] Fix | Delete
'tab_slug' => 'advanced',
[207] Fix | Delete
'toggle_slug' => 'layout',
[208] Fix | Delete
),
[209] Fix | Delete
'posts_number' => array(
[210] Fix | Delete
'default' => 10,
[211] Fix | Delete
'label' => esc_html__( 'Post Count', 'et_builder' ),
[212] Fix | Delete
'type' => 'text',
[213] Fix | Delete
'option_category' => 'configuration',
[214] Fix | Delete
'description' => esc_html__( 'Define the number of projects that should be displayed per page.', 'et_builder' ),
[215] Fix | Delete
'computed_affects' => array(
[216] Fix | Delete
'__projects',
[217] Fix | Delete
),
[218] Fix | Delete
'toggle_slug' => 'main_content',
[219] Fix | Delete
),
[220] Fix | Delete
'include_categories' => array(
[221] Fix | Delete
'label' => esc_html__( 'Included Categories', 'et_builder' ),
[222] Fix | Delete
'type' => 'categories',
[223] Fix | Delete
'meta_categories' => array(
[224] Fix | Delete
'all' => esc_html__( 'All Categories', 'et_builder' ),
[225] Fix | Delete
'current' => esc_html__( 'Current Category', 'et_builder' ),
[226] Fix | Delete
),
[227] Fix | Delete
'option_category' => 'basic_option',
[228] Fix | Delete
'description' => esc_html__( 'Select the categories that you would like to include in the feed.', 'et_builder' ),
[229] Fix | Delete
'toggle_slug' => 'main_content',
[230] Fix | Delete
'computed_affects' => array(
[231] Fix | Delete
'__projects',
[232] Fix | Delete
),
[233] Fix | Delete
'taxonomy_name' => 'project_category',
[234] Fix | Delete
),
[235] Fix | Delete
'show_title' => array(
[236] Fix | Delete
'label' => esc_html__( 'Show Title', 'et_builder' ),
[237] Fix | Delete
'type' => 'yes_no_button',
[238] Fix | Delete
'option_category' => 'configuration',
[239] Fix | Delete
'options' => array(
[240] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[241] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[242] Fix | Delete
),
[243] Fix | Delete
'default_on_front' => 'on',
[244] Fix | Delete
'toggle_slug' => 'elements',
[245] Fix | Delete
'description' => esc_html__( 'Turn project titles on or off.', 'et_builder' ),
[246] Fix | Delete
'mobile_options' => true,
[247] Fix | Delete
'hover' => 'tabs',
[248] Fix | Delete
),
[249] Fix | Delete
'show_categories' => array(
[250] Fix | Delete
'label' => esc_html__( 'Show Categories', 'et_builder' ),
[251] Fix | Delete
'type' => 'yes_no_button',
[252] Fix | Delete
'option_category' => 'configuration',
[253] Fix | Delete
'options' => array(
[254] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[255] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[256] Fix | Delete
),
[257] Fix | Delete
'default_on_front' => 'on',
[258] Fix | Delete
'toggle_slug' => 'elements',
[259] Fix | Delete
'description' => esc_html__( 'Turn the category links on or off.', 'et_builder' ),
[260] Fix | Delete
'mobile_options' => true,
[261] Fix | Delete
'hover' => 'tabs',
[262] Fix | Delete
),
[263] Fix | Delete
'show_pagination' => array(
[264] Fix | Delete
'label' => esc_html__( 'Show Pagination', 'et_builder' ),
[265] Fix | Delete
'type' => 'yes_no_button',
[266] Fix | Delete
'option_category' => 'configuration',
[267] Fix | Delete
'options' => array(
[268] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[269] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[270] Fix | Delete
),
[271] Fix | Delete
'default_on_front' => 'on',
[272] Fix | Delete
'toggle_slug' => 'elements',
[273] Fix | Delete
'description' => esc_html__( 'Enable or disable pagination for this feed.', 'et_builder' ),
[274] Fix | Delete
'mobile_options' => true,
[275] Fix | Delete
'hover' => 'tabs',
[276] Fix | Delete
),
[277] Fix | Delete
'zoom_icon_color' => array(
[278] Fix | Delete
'label' => esc_html__( 'Zoom Icon Color', 'et_builder' ),
[279] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the zoom icon.', 'et_builder' ),
[280] Fix | Delete
'type' => 'color-alpha',
[281] Fix | Delete
'custom_color' => true,
[282] Fix | Delete
'depends_show_if' => 'off',
[283] Fix | Delete
'tab_slug' => 'advanced',
[284] Fix | Delete
'toggle_slug' => 'overlay',
[285] Fix | Delete
'mobile_options' => true,
[286] Fix | Delete
),
[287] Fix | Delete
'hover_overlay_color' => array(
[288] Fix | Delete
'label' => esc_html__( 'Hover Overlay Color', 'et_builder' ),
[289] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the overlay', 'et_builder' ),
[290] Fix | Delete
'type' => 'color-alpha',
[291] Fix | Delete
'custom_color' => true,
[292] Fix | Delete
'depends_show_if' => 'off',
[293] Fix | Delete
'tab_slug' => 'advanced',
[294] Fix | Delete
'toggle_slug' => 'overlay',
[295] Fix | Delete
'mobile_options' => true,
[296] Fix | Delete
),
[297] Fix | Delete
'hover_icon' => array(
[298] Fix | Delete
'label' => esc_html__( 'Hover Icon Picker', 'et_builder' ),
[299] Fix | Delete
'description' => esc_html__( 'Here you can define a custom icon for the overlay', 'et_builder' ),
[300] Fix | Delete
'type' => 'select_icon',
[301] Fix | Delete
'option_category' => 'configuration',
[302] Fix | Delete
'class' => array( 'et-pb-font-icon' ),
[303] Fix | Delete
'depends_show_if' => 'off',
[304] Fix | Delete
'tab_slug' => 'advanced',
[305] Fix | Delete
'toggle_slug' => 'overlay',
[306] Fix | Delete
),
[307] Fix | Delete
'__projects' => array(
[308] Fix | Delete
'type' => 'computed',
[309] Fix | Delete
'computed_callback' => array( 'ET_Builder_Module_Portfolio', 'get_portfolio_item' ),
[310] Fix | Delete
'computed_depends_on' => array(
[311] Fix | Delete
'posts_number',
[312] Fix | Delete
'include_categories',
[313] Fix | Delete
'fullwidth',
[314] Fix | Delete
'__page',
[315] Fix | Delete
),
[316] Fix | Delete
),
[317] Fix | Delete
'__page' => array(
[318] Fix | Delete
'type' => 'computed',
[319] Fix | Delete
'computed_callback' => array( 'ET_Builder_Module_Portfolio', 'get_portfolio_item' ),
[320] Fix | Delete
'computed_affects' => array(
[321] Fix | Delete
'__projects',
[322] Fix | Delete
),
[323] Fix | Delete
),
[324] Fix | Delete
);
[325] Fix | Delete
[326] Fix | Delete
return $fields;
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
public function get_transition_fields_css_props() {
[330] Fix | Delete
$fields = parent::get_transition_fields_css_props();
[331] Fix | Delete
[332] Fix | Delete
$fields['max_width'] = array( 'max-width' => '%%order_class%%, %%order_class%% .et_pb_portfolio_item' );
[333] Fix | Delete
$fields['width'] = array( 'width' => '%%order_class%%, %%order_class%% .et_pb_portfolio_item' );
[334] Fix | Delete
[335] Fix | Delete
return $fields;
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
/**
[339] Fix | Delete
* Get portfolio objects for portfolio module
[340] Fix | Delete
*
[341] Fix | Delete
* @param array $args arguments that affect et_pb_portfolio query
[342] Fix | Delete
* @param array $conditional_tags conditional tag for update process
[343] Fix | Delete
* @param array $current_page current page params
[344] Fix | Delete
*
[345] Fix | Delete
* @return mixed portfolio item data
[346] Fix | Delete
*/
[347] Fix | Delete
static function get_portfolio_item( $args = array(), $conditional_tags = array(), $current_page = array() ) {
[348] Fix | Delete
global $et_fb_processing_shortcode_object, $post;
[349] Fix | Delete
[350] Fix | Delete
$global_processing_original_value = $et_fb_processing_shortcode_object;
[351] Fix | Delete
[352] Fix | Delete
$defaults = array(
[353] Fix | Delete
'posts_number' => 10,
[354] Fix | Delete
'include_categories' => '',
[355] Fix | Delete
'fullwidth' => 'on',
[356] Fix | Delete
);
[357] Fix | Delete
[358] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[359] Fix | Delete
[360] Fix | Delete
// Native conditional tag only works on page load. Data update needs $conditional_tags data
[361] Fix | Delete
$is_front_page = et_fb_conditional_tag( 'is_front_page', $conditional_tags );
[362] Fix | Delete
$is_search = et_fb_conditional_tag( 'is_search', $conditional_tags );
[363] Fix | Delete
[364] Fix | Delete
// Prepare query arguments
[365] Fix | Delete
$query_args = array(
[366] Fix | Delete
'posts_per_page' => (int) $args['posts_number'],
[367] Fix | Delete
'post_type' => 'project',
[368] Fix | Delete
'post_status' => array( 'publish', 'private' ),
[369] Fix | Delete
'perm' => 'readable',
[370] Fix | Delete
);
[371] Fix | Delete
[372] Fix | Delete
// Conditionally get paged data
[373] Fix | Delete
if ( defined( 'DOING_AJAX' ) && isset( $current_page[ 'paged'] ) ) {
[374] Fix | Delete
$et_paged = intval( $current_page[ 'paged' ] );
[375] Fix | Delete
} else {
[376] Fix | Delete
$et_paged = $is_front_page ? get_query_var( 'page' ) : get_query_var( 'paged' );
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
if ( $is_front_page ) {
[380] Fix | Delete
global $paged;
[381] Fix | Delete
$paged = $et_paged; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
// support pagination in VB
[385] Fix | Delete
if ( isset( $args['__page'] ) ) {
[386] Fix | Delete
$et_paged = $args['__page'];
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
if ( ! is_search() ) {
[390] Fix | Delete
$query_args['paged'] = $et_paged;
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
// Passed categories parameter
[394] Fix | Delete
$include_categories = self::filter_include_categories( $args['include_categories'], 0, 'project_category' );
[395] Fix | Delete
[396] Fix | Delete
if ( ! empty( $include_categories ) ) {
[397] Fix | Delete
$query_args['tax_query'] = array(
[398] Fix | Delete
array(
[399] Fix | Delete
'taxonomy' => 'project_category',
[400] Fix | Delete
'field' => 'id',
[401] Fix | Delete
'terms' => $include_categories,
[402] Fix | Delete
'operator' => 'IN',
[403] Fix | Delete
)
[404] Fix | Delete
);
[405] Fix | Delete
}
[406] Fix | Delete
[407] Fix | Delete
// Get portfolio query
[408] Fix | Delete
$query = new WP_Query( $query_args );
[409] Fix | Delete
[410] Fix | Delete
// Format portfolio output, and add supplementary data
[411] Fix | Delete
$width = 'on' === $args['fullwidth'] ? 1080 : 400;
[412] Fix | Delete
$width = (int) apply_filters( 'et_pb_portfolio_image_width', $width );
[413] Fix | Delete
$height = 'on' === $args['fullwidth'] ? 9999 : 284;
[414] Fix | Delete
$height = (int) apply_filters( 'et_pb_portfolio_image_height', $height );
[415] Fix | Delete
$classtext = 'on' === $args['fullwidth'] ? 'et_pb_post_main_image' : '';
[416] Fix | Delete
$titletext = get_the_title();
[417] Fix | Delete
[418] Fix | Delete
// Loop portfolio item data and add supplementary data
[419] Fix | Delete
if ( $query->have_posts() ) {
[420] Fix | Delete
$post_index = 0;
[421] Fix | Delete
while( $query->have_posts() ) {
[422] Fix | Delete
$query->the_post();
[423] Fix | Delete
ET_Post_Stack::replace( $post );
[424] Fix | Delete
[425] Fix | Delete
$categories = array();
[426] Fix | Delete
[427] Fix | Delete
$categories_object = get_the_terms( get_the_ID(), 'project_category' );
[428] Fix | Delete
[429] Fix | Delete
if ( ! empty( $categories_object ) ) {
[430] Fix | Delete
foreach ( $categories_object as $category ) {
[431] Fix | Delete
$categories[] = array(
[432] Fix | Delete
'id' => $category->term_id,
[433] Fix | Delete
'label' => $category->name,
[434] Fix | Delete
'permalink' => get_term_link( $category ),
[435] Fix | Delete
);
[436] Fix | Delete
}
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
// need to disable processnig to make sure get_thumbnail() doesn't generate errors
[440] Fix | Delete
$et_fb_processing_shortcode_object = false;
[441] Fix | Delete
[442] Fix | Delete
// Capture the ALT text defined in WP Media Library
[443] Fix | Delete
$alttext = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );
[444] Fix | Delete
[445] Fix | Delete
// Get thumbnail
[446] Fix | Delete
$thumbnail = get_thumbnail( $width, $height, $classtext, $alttext, $titletext, false, 'Blogimage' );
[447] Fix | Delete
[448] Fix | Delete
$et_fb_processing_shortcode_object = $global_processing_original_value;
[449] Fix | Delete
[450] Fix | Delete
// Append value to query post
[451] Fix | Delete
$query->posts[ $post_index ]->post_permalink = get_permalink();
[452] Fix | Delete
$query->posts[ $post_index ]->featured_image = isset( $thumbnail['fullpath'] ) ? $thumbnail['fullpath'] : null;
[453] Fix | Delete
$query->posts[ $post_index ]->post_thumbnail = print_thumbnail( $thumbnail['thumb'], $thumbnail['use_timthumb'], $titletext, $width, $height, '', false, true );
[454] Fix | Delete
$query->posts[ $post_index ]->post_categories = $categories;
[455] Fix | Delete
$query->posts[ $post_index ]->post_class_name = get_post_class( '', get_the_ID() );
[456] Fix | Delete
[457] Fix | Delete
$post_index++;
[458] Fix | Delete
ET_Post_Stack::pop();
[459] Fix | Delete
}
[460] Fix | Delete
ET_Post_Stack::reset();
[461] Fix | Delete
[462] Fix | Delete
$query->posts_next = array(
[463] Fix | Delete
'label' => esc_html__( '&laquo; Older Entries', 'et_builder' ),
[464] Fix | Delete
'url' => self::get_next_link( $et_paged, $query->max_num_pages ),
[465] Fix | Delete
);
[466] Fix | Delete
[467] Fix | Delete
$query->posts_prev = array(
[468] Fix | Delete
'label' => esc_html__( 'Next Entries &raquo;', 'et_builder' ),
[469] Fix | Delete
'url' => self::get_previous_link( $et_paged ),
[470] Fix | Delete
);
[471] Fix | Delete
[472] Fix | Delete
// Added wp_pagenavi support
[473] Fix | Delete
$query->wp_pagenavi = function_exists( 'wp_pagenavi' ) ? wp_pagenavi( array(
[474] Fix | Delete
'query' => $query,
[475] Fix | Delete
'echo' => false
[476] Fix | Delete
) ) : false;
[477] Fix | Delete
} else if ( self::is_processing_computed_prop() ) {
[478] Fix | Delete
// This is for the VB
[479] Fix | Delete
$query = array( 'posts' => self::get_no_results_template() );
[480] Fix | Delete
}
[481] Fix | Delete
[482] Fix | Delete
return $query;
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
/**
[486] Fix | Delete
* Get the next link
[487] Fix | Delete
*
[488] Fix | Delete
* @param int $paged Current page.
[489] Fix | Delete
* @param int $max Max number of pages.
[490] Fix | Delete
*
[491] Fix | Delete
* @return string|null
[492] Fix | Delete
*/
[493] Fix | Delete
private static function get_next_link( $paged, $max ) {
[494] Fix | Delete
if ( ! $paged ) {
[495] Fix | Delete
$paged = 1;
[496] Fix | Delete
}
[497] Fix | Delete
[498] Fix | Delete
$next_page = $paged + 1;
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function