$category){ if( $key == $nr ){ break; } if( $nr > 0 ){ $result[ $category -> term_id ] = $category -> term_id; }else{ $result[ $category -> term_id ] = $category -> cat_name; } } return $result; } static function get_pages(){ $pages = get_pages(); $result = array(); foreach($pages as $page){ $result[ $page -> ID ] = $page -> post_title; } return $result; } static function get_front_page_content( ){ $result = ''; switch( admin_options::get_values('front_page' , 'resources') ){ case 'categories' :{ $result = self::get_content_categories(); if( empty( $result ) ){ $result = self::get_null_content(); } break; } case 'page' :{ $result = self::get_content_page(); break; } case 'selected_posts' : { $result = self::get_content_selected_posts( ); $result .= self::get_content_latest_posts( ); break; } default :{ $result = self::get_content_latest_posts( ); break; } } return $result; } static function get_front_page_layout( ){ $result = ''; if( strlen( admin_options::get_values('advertising','zone_1' ) ) ){ $result .= '
'; $result .= admin_options::get_values('advertising','zone_1' ); $result .= '
'; } switch( admin_options::get_values('front_page' , 'layout') ){ case 'full-width' :{ $result .= '
'; $result .= self::get_front_page_content(); $result .= '
'; break; } case 'right-sidebar' :{ $result .= '
'; $result .= self::get_front_page_content(); $result .= '
'; $result .= ''; break; } case 'left-sidebar' :{ $result .= ''; $result .= '
'; $result .= self::get_front_page_content(); $result .= '
'; break; } } echo $result; } static function get_content_categories( ){ $categories = admin_options::get_values( 'front_page' , 'categories' ); $result = ''; $i = 1; if( !empty( $categories ) ){ foreach( $categories as $id){ $cat = get_category( $id ); if( admin_options::get_values( 'front_page' , 'layout' ) == 'full-width'){ $nr = 3; }else{ $nr = 2; } if( $i % $nr == 0 ){ $i = 1; $classes = 'last'; }else{ $i++; $classes = ''; } $posts = query_posts('cat='.$id.'&posts_per_page='.admin_options::get_values( 'front_page' , 'nr_post_cat' ) ); $j = 1; $result .= '
'; foreach( $posts as $index => $post ){ if( $j == 1 ){ $result .= '

' . $cat -> cat_name . '

'; $result .= '
'; if( has_post_thumbnail( $post -> ID ) ){ $result .= ''; $args = array( 'numberposts' => -1, 'post_type' => 'attachment', 'status' => 'publish', 'post_mime_type' => 'image', 'post_parent' => $post -> ID ); $images = &get_children($args); if( isset( $images[ get_post_thumbnail_id( $post -> ID ) ] ) ){ $text = $images[ get_post_thumbnail_id( $post -> ID ) ] -> post_excerpt; }else{ $args = array( 'numberposts' => -1, 'post_type' => 'attachment', 'status' => 'publish', 'post_mime_type' => 'image', 'post_parent' => 0 ); $images = &get_children($args); if( isset( $images[ get_post_thumbnail_id( $post -> ID ) ] ) ){ $text = $images[ get_post_thumbnail_id( $post -> ID ) ] -> post_excerpt; }else{ $text = ''; } } $result .= '' . $text . ''; $result .= '' . wp_get_attachment_image( get_post_thumbnail_id( $post -> ID ) , '270x100' ) . ''; $result .= ''; }else{ $result .= ''; $result .= ''; $result .= ''; } if('open' == $post->comment_status) { $result .= '

'. get_comments_number( $post -> ID ) .'

'; } $result .= ''; $result .= '

'; $result .= $post -> post_title ; $result .= '

'; $result .= '

'; $result .= de_excerpt( $post -> post_excerpt , $post -> post_content , CAT_CNT_LN ); $result .= '

'; $result .= '
'; $result .= '
'; $result .= '

' . date('F j, Y' , strtotime($post -> post_date ) ) . '

'; $result .= '

'. get_the_author_meta( 'display_name' , $post-> post_author ) .'

'; $result .= '
'; $result .= '
'; $result .= ''; $result .= '
'; if( $classes == 'last' ){ $result .= '
'; if( self::$adds ){ if( strlen( admin_options::get_values('advertising','zone_2' ) ) ){ $result .= '
'; $result .= admin_options::get_values('advertising','zone_2' ); $result .= '
'; self::$adds = false; } } } } } return $result; } static function get_content_selected_posts( ){ $query = array(); $query['paged'] = self::get_page(); $query['meta_key'] = 'front_page'; $query['post__not_in'] = get_option( 'sticky_posts' ); $wp_query = new WP_Query( $query ); $result = ''; foreach( $wp_query -> posts as $post ){ $result .= '
'; $result .= '

' . $post -> post_title . '

'; $result .= '
'; $result .= '

'.get_the_time( 'j F Y, H:i').'

'; $result .= '

'.get_the_author_meta( 'display_name' , $post-> post_author ).'

'; $result .= '

'.get_comments_number( $post -> ID ).'

'; $result .= '
'; $result .= '
'; if( has_post_thumbnail( $post -> ID ) ){ $result .= '
'; $result .= wp_get_attachment_image( get_post_thumbnail_id( $post -> ID ) , '160x120' ); $args = array( 'numberposts' => -1, 'post_type' => 'attachment', 'status' => 'publish', 'post_mime_type' => 'image', 'post_parent' => $post -> ID ); $images = &get_children($args); if( isset( $images[ get_post_thumbnail_id( $post -> ID ) ] ) ){ $text = $images[ get_post_thumbnail_id( $post -> ID ) ] -> post_excerpt; }else{ $args = array( 'numberposts' => -1, 'post_type' => 'attachment', 'status' => 'publish', 'post_mime_type' => 'image', 'post_parent' => 0 ); $images = &get_children($args); if( isset( $images[ get_post_thumbnail_id( $post -> ID ) ] ) ){ $text = $images[ get_post_thumbnail_id( $post -> ID ) ] -> post_excerpt; }else{ $text = ''; } } $result .= '' . $text . ''; $result .= '
'; } $result .= '

'; $result .= do_shortcode( $post -> post_content ); $result .= '

'; $result .= '
'; $tags = wp_get_post_tags( $post -> ID ); if( !empty( $tags ) ){ $result .= '
'; foreach( $tags as $tag ){ $result .= ''. $tag -> name .''; } $result .= '
'; } $result .= '
'; if( self::$adds ){ if( strlen( admin_options::get_values('advertising','zone_2' ) ) ){ $result .= '
'; $result .= admin_options::get_values('advertising','zone_2' ); $result .= '
'; self::$adds = false; } } } wp_reset_query(); return $result; } static function get_content_latest_posts( ){ $query = array(); $query['paged'] = self::get_page(); $query['post__not_in'] = self::get_exclude_posts(); $query['posts_per_page'] = get_option('posts_per_page'); $wp_query = new WP_Query( $query ); $result = '';