query->get_posts( $query_args, true ); if ( ! $posts->have_posts() ) { wp_reset_postdata(); } $_page_id = null; if ( is_single() ) { $_page_id = get_the_ID(); } // if there have list icon url from settings or customizer or shortcodes attribites format it to $list_icon_name $settings_list_icon = betterdocs()->settings->get( 'docs_list_icon' ); // Ensure $layout_type is set if ( ! isset( $layout_type ) ) { $layout_type = ''; } // Ensure $list_icon_url is set if ( ! isset( $list_icon_url ) ) { $list_icon_url = ''; } // Ensure $list_icon_name is always initialized as an array to prevent TypeError if ( ! isset( $list_icon_name ) || ! is_array( $list_icon_name ) ) { $list_icon_name = array(); } #for elementor if icon is not selected from settings, and icon attributes are empty, then look for settings, if settings is empty show default icon, else show from settings. If svg from list is selected, then show svg, else show from settings, if settings is empty then show default. Not applicable for sidebar layout-2 elementor if ( isset( $layout_type ) && 'widget' == $layout_type ) { if ( isset( $sidebar_layout ) && 'layout-2' == $sidebar_layout ) { #done to avoid warning for elementor sidebar layout-2 $list_icon_name = array(); } // Ensure $list_icon_name is an array before using array_key_exists if ( ! is_array( $list_icon_name ) ) { $list_icon_name = array(); } $list_icon_name = ( array_key_exists( 'value', $list_icon_name ) && array_key_exists( 'library', $list_icon_name ) || array_key_exists( 'value', $list_icon_name ) ) ? ( empty( $list_icon_name[ 'value' ] ) && empty( $list_icon_name[ 'library' ] ) || empty( $list_icon_name[ 'value' ] ) ? ( isset( $settings_list_icon[ 'url' ] ) ? array( 'value' => array( 'url' => $settings_list_icon[ 'url' ] ) ) : array() ) : $list_icon_name ) : ( isset( $list_icon_name[ 'url' ] ) ? array( 'value' => array( 'url' => $list_icon_name[ 'url' ] ) ) : ( isset( $settings_list_icon[ 'url' ] ) ? $settings_list_icon[ 'url' ] : array() ) ); } // #for blocks if $list_icon_name is empty, but for category grid block if ( isset( $layout_type ) && 'block' == $layout_type ) { if ( empty( $list_icon_name ) && isset( $widget_type ) && 'category-grid' == $widget_type ) { $list_icon_name = array( 'value' ); } } #for blocks if $sidebar_layout is passed, then remove the list icon for layout-4 if ( isset( $layout_type ) && 'block' == $layout_type ) { if ( isset( $sidebar_layout ) && 'layout-4' == $sidebar_layout ) { $list_icon_name = array( 'value' => array( 'url' => 'list' ) ); } } if ( isset( $layout_type ) && ! empty( $layout_type ) && 'template' == $layout_type && isset( $list_icon_url ) && $list_icon_url ) { if ( isset( $list_icon_url ) && $list_icon_url ) { $list_icon_name = array( 'value' => array( 'url' => $list_icon_url ) ); } } ?>