Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function catchflames_page_content( $options ) {
- global $post;
- $quantity = $options['featured_content_number'];
- $show_content = $options['featured_content_show'];
- $number_of_page = 0; // for number of pages
- $page_list = array(); // list of valid pages ids
- $catchflames_page_content = '';
- //Get valid pages
- for( $i = 1; $i <= $quantity; $i++ ){
- if ( isset ( $options['featured_content_page'][ $i ] ) && $options['featured_content_page'][ $i ] > 0 ){
- $number_of_page++;
- $page_list = array_merge( $page_list, array( $options['featured_content_page'][ $i ] ) );
- }
- }
- if ( !empty( $page_list ) && $number_of_page > 0 ) {
- $loop = new WP_Query( array(
- 'posts_per_page' => $number_of_page,
- 'post__in' => $page_list,
- 'orderby' => 'post__in',
- 'post_type' => 'page',
- ));
- $i=0;
- while ( $loop->have_posts()) : $loop->the_post(); $i++;
- $title_attribute = the_title_attribute( array( 'before' => __( 'Permalink to: ', 'catch-flames' ), 'echo' => false ) );
- $excerpt = get_the_excerpt();
- $catchflames_page_content .= '
- <article id="featured-post-' . $i . '" class="post hentry featured-page-content">';
- if ( has_post_thumbnail() ) {
- $catchflames_page_content .= '
- <figure class="featured-homepage-image">
- <a href="' . esc_url( get_permalink() ) . '" title="'.the_title( '', '', false ).'">
- '. get_the_post_thumbnail( $post->ID, 'full', array( 'title' => $title_attribute, 'alt' => $title_attribute, 'class' => 'pngfix' ) ) .'
- </a>
- </figure>';
- }
- else {
- $catchflames_first_image = catchflames_get_first_image( $post->ID, 'catch-flames-featured-content', array( 'title' => $title_attribute, 'alt' => $title_attribute, 'class' => 'pngfix' ) );
- if ( '' != $catchflames_first_image ) {
- $catchflames_page_content .= '
- <figure class="featured-homepage-image">
- <a href="' . esc_url( get_permalink() ) . '" title="'.the_title( '', '', false ).'">
- '. $catchflames_first_image .'
- </a>
- </figure>';
- }
- }
- $catchflames_page_content .= '
- <div class="entry-container">
- <header class="entry-header">
- <h1 class="entry-title">
- <a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . the_title( '','', false ) . '</a>
- </h1>
- </header>';
- if ( 'excerpt' == $show_content ) {
- $catchflames_page_content .= '<div class="entry-excerpt"><p>' . $excerpt . '</p></div><!-- .entry-excerpt -->';
- }
- elseif ( 'full-content' == $show_content ) {
- $content = apply_filters( 'the_content', get_the_content() );
- $content = str_replace( ']]>', ']]>', $content );
- $catchflames_page_content .= '<div class="entry-content">' . wp_kses_post( $content ) . '</div><!-- .entry-content -->';
- }
- $catchflames_page_content .= '
- </div><!-- .entry-container -->
- </article><!-- .featured-post-'. $i .' -->';
- endwhile;
- wp_reset_postdata();
- }
- return $catchflames_page_content;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement