= 1 && intval( $columns ) <= 5 ) ? intval( $columns ) : 3; $column = 1; // Set clearfix to avoid error if there are no boxes $clearfix = 1; // Set user defined style for content boxes $userstyle = $style; // Create a custom WP Query $page_ids = array(); foreach ( $boxes as $key => $box ) { $box['page'] = ( isset( $box['page'] ) ) ? intval( $box['page'] ) : ''; if ( !empty( $box['page'] ) ) $page_ids[] = $box['page']; } if ( empty( $page_ids ) ) return; // If $page_ids is empty, custom query below will return all posts $query_args = array( 'post_type' => 'page', 'post__in' => $page_ids, 'posts_per_page' => -1, 'orderby' => 'post__in' ); $query_args = apply_filters( 'hootubix_content_blocks_query', $query_args, $instance, $before_title, $title, $after_title ); $content_blocks_query = new WP_Query( $query_args ); // Temporarily remove read more links from excerpts hootubix_remove_readmore_link(); // Template modification Hook do_action( 'hootubix_content_blocks_wrap', 'pages', $content_blocks_query, $page_ids ); ?>
$box ) : if ( !empty( $box['page'] ) ) : global $post; $altPage = ( function_exists('pll_get_post') ) ? pll_get_post($box['page']) : $box['page']; $box['excerpt'] = ( empty( $box['excerpt'] ) ) ? 'content' : ( ( $box['excerpt'] === 1 ) ? 'excerpt' : $box['excerpt'] ); // Backward Compatible $box['excerptlength'] = ( empty( $box['excerptlength'] ) )? 0 : intval( $box['excerptlength'] ); foreach( $content_blocks_query->posts as $post ) : if ( $box['page'] == $post->ID || $altPage == $post->ID ) : // Init setup_postdata( $post ); $visual = $visualtype = ''; $box['icon_style'] = ( isset( $box['icon_style'] ) ) ? $box['icon_style'] : 'none'; // Refresh user style (to add future op of diff styles for each block) $style = $userstyle; // Style-3 exceptions: doesnt work great with icons of 'None' style, or with images or with no visual at all. So revert to Style-2 for this scenario. if ( $style == 'style3' ) { if ( !empty( $box['icon'] ) ) { if ( $box['icon_style'] == 'none' ) $style = 'style2'; } else $style = 'style2'; $style = 'style3'; } // Set image or icon if ( !empty( $box['icon'] ) ) { $visualtype = 'icon'; $visual = ''; } elseif ( has_post_thumbnail() ) { $visualtype = 'image'; if ( $style == 'style4' ) { switch ( $columns ) { case 1: $img_size = 2; break; case 2: $img_size = 4; break; default: $img_size = 5; } } else { $img_size = $columns; } $img_size = hootubix_thumbnail_size( 'column-1-' . $img_size ); $img_size = apply_filters( 'hootubix_content_block_img', $img_size, $columns, $style ); $visual = 1; } // Set Block Class (if no visual for style 2/3, then dont highlight) $block_class = ( !empty( $visual ) && ( $style == 'style2' || $style == 'style3' ) ) ? 'highlight-typo' : 'no-highlight'; $column_class = ( !empty( $visualtype ) ) ? "visual-{$visualtype}" : 'visual-none'; // Set URL if ( $box['excerpt'] === 'excerpt' && empty( $box['url'] ) ) { $linktag = ''; $linktagend = ''; } elseif ( !empty( $box['url'] ) ) { $linktag = ''; $linktagend = ''; } else { $linktag = $linktagend = ''; } // Start Block Display if ( $column == 1 ) echo '
'; ?>

' . wp_kses_post( $box['subtitle'] ) . '
'; ?> '; the_content(); echo '
'; } elseif ( $box['excerpt'] === 'excerpt' ) { echo '
'; if( !empty( $box['excerptlength'] ) ) echo hybridextend_get_excerpt( $box['excerptlength'] ); else the_excerpt(); echo '
'; } ?>
' . $linktag . esc_html( $linktext ) . $linktagend . '

'; ?>
'; $column = $clearfix = 1; } else { $clearfix = false; $column++; } break; endif; endforeach; wp_reset_postdata(); endif; endforeach; if ( !$clearfix ) echo '
'; ?>