: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$thumb_array['fullpath'] = $et_fullpath[0];
$thumb_array['thumb'] = $thumb_array['fullpath'];
if ( empty( $thumb_array['thumb'] ) ) {
if ( empty( $custom_field ) ) $thumb_array['thumb'] = esc_attr( get_post_meta( $post->ID, 'Thumbnail', $single = true ) );
$thumb_array['thumb'] = esc_attr( get_post_meta( $post->ID, $custom_field, $single = true ) );
if ( empty( $thumb_array['thumb'] ) ) $thumb_array['thumb'] = esc_attr( get_post_meta( $post->ID, 'Thumbnail', $single = true ) );
if ( '' === $thumb_array['thumb'] && et_grab_image_setting() ) {
$thumb_array['thumb'] = esc_attr( et_first_image() );
if ( $fullpath ) $thumb_array['fullpath'] = $thumb_array['thumb'];
#if custom field used for small pre-cropped image, open Thumbnail custom field image in lightbox
$thumb_array['fullpath'] = $thumb_array['thumb'];
if ( empty( $custom_field ) ) $thumb_array['fullpath'] = apply_filters( 'et_fullpath', et_path_reltoabs( esc_attr( $thumb_array['thumb'] ) ) );
elseif ( ! empty( $custom_field ) && get_post_meta( $post->ID, 'Thumbnail', $single = true ) ) $thumb_array['fullpath'] = apply_filters( 'et_fullpath', et_path_reltoabs( esc_attr( get_post_meta( $post->ID, 'Thumbnail', $single = true ) ) ) );
if ( ! function_exists( 'et_grab_image_setting' ) ) :
* Filterable "Grab the first post image" setting.
* "Grab the first post image" needs to be filterable so it can be disabled forcefully.
* It uses et_first_image() which uses apply_filters( 'the_content' ) which could cause
* a conflict with third party plugin which extensively uses 'the_content' filter (ie. BuddyPress)
function et_grab_image_setting() {
// Force disable "Grab the first post image" in BuddyPress component page
$is_buddypress_component = function_exists( 'bp_current_component' ) && bp_current_component();
$setting = 'on' === et_get_option( "{$shortname}_grab_image" ) && ! $is_buddypress_component;
return apply_filters( 'et_grab_image_setting', $setting );
/* this function prints thumbnail from Post Thumbnail or Custom field or First post image */
if ( ! function_exists( 'print_thumbnail' ) ) {
function print_thumbnail($thumbnail = '', $use_timthumb = true, $alttext = '', $width = 100, $height = 100, $class = '', $echoout = true, $forstyle = false, $resize = true, $post='', $et_post_id = '' ) {
if ( is_array( $thumbnail ) ) {
if ( empty( $post ) ) global $post, $et_theme_image_sizes;
$thumbnail_orig = $thumbnail;
$et_post_id = ! empty( $et_post_id ) ? (int) $et_post_id : $post->ID;
if ( has_post_thumbnail( $et_post_id ) ) {
$thumb_array['use_timthumb'] = false;
$image_size_name = $width . 'x' . $height;
$et_size = isset( $et_theme_image_sizes ) && array_key_exists( $image_size_name, $et_theme_image_sizes ) ? $et_theme_image_sizes[$image_size_name] : array( $width, $height );
$et_attachment_image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $et_post_id ), $et_size );
$thumbnail = $et_attachment_image_attributes[0];
$thumbnail = et_multisite_thumbnail( $thumbnail );
$allow_new_thumb_method = false;
$external_source = false;
$allow_new_thumb_method = !$external_source && $new_method && empty( $cropPosition );
if ( $allow_new_thumb_method && !empty( $thumbnail ) ) {
if ( 'data:image' === substr( $thumbnail, 0, 10 ) ) {
$new_method_thumb = $thumbnail;
$et_crop = get_post_meta( $post->ID, 'et_nocrop', true );
$et_crop = empty( $et_crop ) ? true : false;
$new_method_thumb = et_resize_image( et_path_reltoabs( $thumbnail ), $width, $height, $et_crop );
if ( is_wp_error( $new_method_thumb ) ) {
$thumbnail = $new_method_thumb;
if ( false === $forstyle && $resize ) {
if ( $width < 480 && et_is_responsive_images_enabled() && ! $raw ) {
'<img src="%1$s" alt="%2$s" class="%3$s" srcset="%4$s " sizes="%5$s " %6$s />',
esc_attr( wp_strip_all_tags( $alttext ) ),
empty( $class ) ? '' : esc_attr( $class ),
$thumbnail_orig . ' 479w, ' . $thumbnail . ' 480w',
'(max-width:479px) 479px, 100vw',
apply_filters( 'et_print_thumbnail_dimensions', " width='" . esc_attr( $width ) . "' height='" . esc_attr( $height ) . "'" )
'<img src="%1$s" alt="%2$s" class="%3$s"%4$s />',
$raw ? $thumbnail : esc_url( $thumbnail ),
esc_attr( wp_strip_all_tags( $alttext ) ),
empty( $class ) ? '' : esc_attr( $class ),
apply_filters( 'et_print_thumbnail_dimensions', " width='" . esc_attr( $width ) . "' height='" . esc_attr( $height ) . "'" )
$output = et_image_add_srcset_and_sizes( $output );
if ($echoout) echo et_core_intentionally_unescaped( $output, 'html' );
if ( ! function_exists( 'et_new_thumb_resize' ) ) {
function et_new_thumb_resize( $thumbnail, $width, $height, $alt='', $forstyle = false ){
$external_source = false;
$allow_new_thumb_method = !$external_source && $new_method;
if ( $allow_new_thumb_method && ! empty( $thumbnail ) ) {
$new_method_thumb = et_resize_image( $thumbnail, $width, $height, $et_crop );
if ( is_wp_error( $new_method_thumb ) ) $new_method_thumb = '';
$thumb = esc_attr( $new_method_thumb );
// Bail early when $forstyle argument is true.
'<img src="%1$s" alt="%2$s" width="%3$s" height="%4$s" />',
return et_image_add_srcset_and_sizes( $output );
if ( ! function_exists( 'et_multisite_thumbnail' ) ) {
function et_multisite_thumbnail( $thumbnail = '' ) {
// do nothing if it's not a Multisite installation or current site is the main one
if ( is_main_site() ) return $thumbnail;
preg_match( '#([_0-9a-zA-Z-]+/)?files/(.+)#', $thumbnail, $matches );
if ( isset( $matches[2] ) ) {
$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $matches[2] );
if ( is_file( $file ) ) $thumbnail = str_replace( ABSPATH, trailingslashit( get_site_url( 1 ) ), $file );
if ( ! function_exists( 'et_is_portrait' ) ) {
function et_is_portrait($imageurl, $post='', $ignore_cfields = false){
if ( empty( $post ) ) global $post;
if ( get_post_meta( $post->ID, 'et_disable_portrait', true ) === '1' ) return false;
if ( !$ignore_cfields ) {
if ( get_post_meta( $post->ID, 'et_imagetype', true ) === 'l' ) return false;
if ( get_post_meta( $post->ID, 'et_imagetype', true ) === 'p' ) return true;
$imageurl = et_path_reltoabs( et_multisite_thumbnail( $imageurl ) );
$et_thumb_size = @getimagesize( $imageurl );
if ( empty( $et_thumb_size ) ) {
$et_thumb_size = @getimagesize( str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $imageurl ) );
if ( empty( $et_thumb_size ) ) return false;
$et_thumb_width = $et_thumb_size[0];
$et_thumb_height = $et_thumb_size[1];
$result = ($et_thumb_width < $et_thumb_height) ? true : false;
if ( ! function_exists( 'et_path_reltoabs' ) ) {
function et_path_reltoabs( $imageurl ){
if ( strpos( strtolower( $imageurl ), 'http://' ) !== false || strpos( strtolower( $imageurl ), 'https://' ) !== false ) return $imageurl;
if ( strpos( strtolower( $imageurl ), $_SERVER['HTTP_HOST'] ) !== false )
$imageurl = esc_url( apply_filters( 'et_path_relative_image', site_url() . '/' ) . $imageurl );
if ( ! function_exists( 'in_subcat' ) ) {
function in_subcat($blogcat,$current_cat='') {
if (cat_is_ancestor_of( $blogcat, $current_cat ) || $blogcat === $current_cat) $in_subcategory = true;
if ( ! function_exists( 'show_page_menu' ) ) {
function show_page_menu($customClass = 'nav clearfix', $addUlContainer = true, $addHomeLink = true){
global $shortname, $themename, $exclude_pages, $strdepth, $page_menu, $is_footer;
if ( $menupages = et_get_option( $shortname.'_menupages' ) ) {
$exclude_pages = implode( ",", $menupages );
if ( et_get_option( $shortname.'_enable_dropdowns' ) === 'on' ) {
$strdepth = "depth=".et_get_option( $shortname.'_tiers_shown_pages' );
if ( empty( $strdepth ) ) {
$page_menu = wp_list_pages( "sort_column=".et_get_option( $shortname.'_sort_pages' )."&sort_order=".et_get_option( $shortname.'_order_page' )."&".$strdepth."&exclude=".$exclude_pages."&title_li=&echo=0" );
if ( $addUlContainer ) echo '<ul class="' . esc_attr( $customClass ) . '">';
if (et_get_option( $shortname . '_home_link' ) === 'on' && $addHomeLink) { ?>
<li <?php if ( is_front_page() || is_home() ) echo 'class="current_page_item"' ?>><a href="<?php echo esc_url( home_url() ); ?>"><?php esc_html_e( 'Home', $themename ); ?></a></li>
echo et_core_esc_wp( $page_menu );
if ( $addUlContainer ) echo '</ul>';
if ( ! function_exists( 'show_categories_menu' ) ) {
function show_categories_menu($customClass = 'nav clearfix', $addUlContainer = true){
global $shortname, $themename, $category_menu, $exclude_cats, $hide, $strdepth2, $projects_cat;
if ( $menucats = et_get_option( $shortname.'_menucats' ) ) {
$exclude_cats = implode( ",", $menucats );
if (et_get_option( $shortname.'_categories_empty' ) === 'on') $hide = '1';
//dropdown for categories
if ( et_get_option( $shortname.'_enable_dropdowns_categories' ) === 'on' ) $strdepth2 = "depth=".et_get_option( $shortname.'_tiers_shown_categories' );
if ( empty( $strdepth2 ) ) $strdepth2 = "depth=1";
$args = "orderby=".et_get_option( $shortname.'_sort_cat' )."&order=".et_get_option( $shortname.'_order_cat' )."&".$strdepth2."&exclude=".$exclude_cats."&hide_empty=".$hide."&title_li=&echo=0";
$categories = get_categories( $args );
if ( !empty( $categories ) ) {
$args_array = wp_parse_args( $args );
if ( isset( $args_array['exclude'] ) && '' !== $args_array['exclude'] ) {
$args_array['exclude'] = explode( ',', $args_array['exclude'] );
$category_menu = wp_list_categories( $args_array );
if ( $addUlContainer ) echo '<ul class="' . esc_attr( $customClass ) . '">';
echo et_core_esc_wp( $category_menu );
if ( $addUlContainer ) echo '</ul>';
global $shortname, $default_colorscheme;
// phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
$color_scheme = apply_filters( 'et_get_additional_color_scheme', et_get_option( $shortname.'_color_scheme' ) );
if ( !empty( $color_scheme ) && $color_scheme !== $default_colorscheme ) { ?>
<link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() . '/style-' . et_get_option( $shortname.'_color_scheme' ) . '.css' ); ?>" type="text/css" media="screen" />
$child_cssurl = et_get_option( $shortname.'_child_cssurl' );
if ( et_get_option( $shortname.'_child_css' ) === 'on' && ! empty( $child_cssurl ) ) { //Enable child stylesheet ?>
<link rel="stylesheet" href="<?php echo esc_url( $child_cssurl ); ?>" type="text/css" media="screen" />
//prints the theme name, version in meta tag
$theme_info = wp_get_theme();
echo '<meta content="' . esc_attr( $theme_info->display( 'Name' ) . ' v.' . $theme_info->display( 'Version' ) ) . '" name="generator"/>';
if ( et_get_option( $shortname . '_custom_colors' ) === 'on' ) et_epanel_custom_colors_css();
}// end function head_addons()
add_action( 'wp_head', 'head_addons', 7 );
function integration_head(){
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
$integration_head = et_get_option( $shortname . '_integration_head' );
if ( ! empty( $integration_head ) && et_get_option( $shortname . '_integrate_header_enable' ) === 'on' ) {
$integration_head = et_core_fix_unclosed_html_tags( $integration_head );
echo et_core_intentionally_unescaped( $integration_head, 'html' );
add_action( 'wp_head', 'integration_head', 12 );
function integration_body(){
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
$integration_body = et_get_option( $shortname . '_integration_body' );
if ( ! empty( $integration_body ) && et_get_option( $shortname . '_integrate_body_enable' ) === 'on' ) {
$integration_body = et_core_fix_unclosed_html_tags( $integration_body );
echo et_core_intentionally_unescaped( $integration_body, 'html' );
add_action( 'wp_footer', 'integration_body', 12 );
function integration_single_top(){
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
$integration_single_top = et_get_option( $shortname . '_integration_single_top' );
if ( ! empty( $integration_single_top ) && et_get_option( $shortname . '_integrate_singletop_enable' ) === 'on' ) {
$integration_single_top = et_core_fix_unclosed_html_tags( $integration_single_top );
echo et_core_intentionally_unescaped( $integration_single_top, 'html' );
add_action( 'et_before_post', 'integration_single_top', 12 );
function integration_single_bottom(){
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
$integration_single_bottom = et_get_option( $shortname . '_integration_single_bottom' );
if ( ! empty( $integration_single_bottom ) && et_get_option( $shortname . '_integrate_singlebottom_enable' ) === 'on' ) {
$integration_single_bottom = et_core_fix_unclosed_html_tags( $integration_single_bottom );
echo et_core_intentionally_unescaped( $integration_single_bottom, 'html' );
add_action( 'et_after_post', 'integration_single_bottom', 12 );
/*this function gets page name by its id*/
if ( ! function_exists( 'get_pagename' ) ) {
function get_pagename( $page_id )
$page_object = get_page( $page_id );
return apply_filters( 'the_title', $page_object->post_title, $page_id );
/*this function gets category name by its id*/
if ( ! function_exists( 'get_categname' ) ) {
function get_categname( $cat_id )
return get_cat_name( $cat_id );
/*this function gets category id by its name*/
if ( ! function_exists( 'get_catId' ) ) {
function get_catId( $cat_name, $taxonomy = 'category' )
$cat_name_id = is_numeric( $cat_name ) ? (int) $cat_name : (int) get_cat_ID( html_entity_decode( $cat_name, ENT_QUOTES ) );
if ( function_exists( 'icl_object_id' ) ) {
$cat_name_id = (int) icl_object_id( $cat_name_id, $taxonomy, true );
/*this function gets page id by its name*/
if ( ! function_exists( 'get_pageId' ) ) {
function get_pageId( $page_name )
if ( is_numeric( $page_name ) ) {
$page_id = intval( $page_name );
$page_name = html_entity_decode( $page_name, ENT_QUOTES );
$page = get_page_by_title( $page_name );
$page_id = intval( $page->ID );
if ( function_exists( 'icl_object_id' ) )
$page_id = (int) icl_object_id( $page_id, 'page', true );
* Transforms an array of posts, pages, post_tags or categories ids
* into corresponding "objects" ids, if WPML plugin is installed
* @param array $ids_array Posts, pages, post_tags or categories ids.
* @param string $type "Object" type.
if ( ! function_exists( 'et_generate_wpml_ids' ) ) {
function et_generate_wpml_ids( $ids_array, $type ) {
if ( function_exists( 'icl_object_id' ) ) {
foreach ( $ids_array as $id ) {