/** * */ function miss_query_posts() { global $wp_query, $irish_framework_params; $post_obj = $wp_query->get_queried_object(); $exclude_categories = miss_exclude_category_string(); $blog_layout = $irish_framework_params->layout['blog']['blog_layout']; $irish_framework_params->offset = $blog_layout == 'blog_layout2' || $blog_layout == 'blog_layout3' ? $irish_framework_params->layout['blog']['featured'] : false; if ($irish_framework_params->offset) { $irish_framework_params->offset = "1"; } // $blog_page = miss_blog_page(); // if( $blog_page == $post_obj->ID ) { // $irish_framework_params->is_blog = true; // } /* Reset offset for categories and search results */ if (is_archive() || is_search()) { $irish_framework_params->offset = "0"; } $paged = miss_get_page_query(); if (!empty($exclude_categories)) { $query_string = "cat={$exclude_categories}&paged={$paged}"; } else { $query_string = "paged={$paged}"; } if (is_home() || is_front_page()) { $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } else { if (!empty($irish_framework_params->offset)) { if ($paged > 1) { $irish_framework_params->offset = 1; //$irish_framework_params->offset = (get_settings('posts_per_page')*$paged)/2+1; } else { $irish_framework_params->offset = 1; } $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } else { $irish_framework_params->offset = "0"; $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } } //print $query_string; if (isset($irish_framework_params->is_blog)) { return query_posts($query_string); } if (is_archive() || is_search()) { $irish_framework_params->archive_search = true; $irish_framework_params->offset = "0"; $args = array_merge($wp_query->query, array('post_type' => get_post_type(), 'category__not_in' => miss_exclude_category_array($minus = false), 'offset' => $irish_framework_params->offset)); return query_posts($args); } elseif (!empty($post_obj->ID)) { $blog_page = miss_blog_page(); if ($blog_page == $post_obj->ID) { $irish_framework_params->is_blog = true; $irish_framework_params->blog_page = $post_obj->ID; if (!empty($irish_framework_params->offset)) { $irish_framework_params->posts_per_page = get_option('posts_per_page'); add_filter('post_limits', 'my_post_limit'); } return query_posts($query_string); } } elseif (is_front_page() && miss_get_setting('frontpage_blog') || !empty($post_obj->ID) && get_option('page_for_posts') == $post_obj->ID) { if (!empty($irish_framework_params->offset)) { $irish_framework_params->posts_per_page = get_option('posts_per_page'); add_filter('post_limits', 'my_post_limit'); } $args = array_merge($wp_query->query, array('post_type' => 'post', 'paged' => $paged, 'offset' => $irish_framework_params->offset, 'category__not_in' => miss_exclude_category_array($minus = false))); return query_posts($args); } return false; }
/** * */ public static function im_news($atts = null, $content = null) { if ($atts == 'generator') { return array('name' => __('News', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_news', 'icon' => 'im-icon-newspaper', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => array(array('heading' => __('Caption', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter news block title.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'caption', 'type' => 'textfield', 'value' => ''), array('heading' => __('Tagline', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter news block tagline.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'tagline', 'type' => 'textfield', 'value' => ''), array('heading' => __('Number of Posts', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select the number of posts you wish to have displayed on each page.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'showposts', 'min' => 1, 'value' => 5, 'max' => 40, 'step' => 1, 'unit' => __('posts', MISS_ADMIN_TEXTDOMAIN), 'type' => 'range'), array('heading' => __('Offset Posts <small>(optional)</small>', MISS_ADMIN_TEXTDOMAIN), 'description' => __('This will skip a number of posts at the beginning.<br /><br />Useful if you are using multiple blog shortcodes on the same page.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'offset', 'min' => 0, 'value' => 0, 'max' => 40, 'step' => 1, 'unit' => __('posts', MISS_ADMIN_TEXTDOMAIN), 'type' => 'range'), array('heading' => __('Disable Post Elements <small>(optional)</small>', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can hide certain elements from displaying here.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'disable', 'type' => 'checkbox', 'value' => array(__('Disable Post Image', MISS_ADMIN_TEXTDOMAIN) => 'image', __('Disable Post Title', MISS_ADMIN_TEXTDOMAIN) => 'title', __('Disable Post Content', MISS_ADMIN_TEXTDOMAIN) => 'content', __('Disable Post Meta', MISS_ADMIN_TEXTDOMAIN) => 'meta', __('Disable Read More', MISS_ADMIN_TEXTDOMAIN) => 'more')), array("type" => "dropdown", "heading" => __("Viewport Animation", "js_composer"), "param_name" => "animation", "value" => miss_js_composer_css_animation(), "description" => __("Viewport animation will be triggered when this element is being viewed when you scroll page down. you only need to choose the animation style from this option. please note that this only works in moderns. We have disabled this feature in touch devices to increase browsing speed.", "js_composer")))); } $atts = shortcode_atts(array('class' => 'claen', 'caption' => '', 'tagline' => '', 'thumb' => '', 'showposts' => '', 'offset' => '', 'post_content' => '', 'type' => 'news_list', 'categories' => '', 'pagination' => '', 'disable' => '', 'caption' => '', 'tagline' => '', 'post_in' => '', 'category_in' => '', 'tag_in' => '', 'animation' => ''), $atts); extract($atts); if ($animation != '') { $animation = ' im-animate-element ' . $animation . ' '; } global $post, $wp_rewrite, $wp_query, $irish_framework_params; $out = ''; $showposts = trim($showposts); $column = !empty($column) ? trim($column) : '4'; $thumb = !empty($thumb) ? trim($thumb) : 'small'; $offset = isset($offset) ? trim($offset) : ''; $post_in = !empty($post_in) ? explode(",", trim($post_in)) : ''; $category_in = !empty($category_in) ? explode(",", trim($category_in)) : ''; $tag_in = !empty($tag_in) ? explode(",", trim($tag_in)) : ''; if (is_front_page()) { $_layout = miss_get_setting('homepage_layout'); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $template = get_post_meta($post_obj->ID, '_wp_page_template', true); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' || $template == 'templates/template-wiki.php' ? 'small_sidebar_images' : 'big_sidebar_images'); } $post_img = ''; $news_query = new WP_Query(); if (trim($pagination) == 'true') { $paged = miss_get_page_query(); $news_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'news', 'posts_per_page' => $showposts, 'paged' => $paged, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } else { $news_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'news', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } if ($news_query->have_posts()) { $img_sizes = $irish_framework_params->layout[$images]; $width = ''; $height = ''; if ($atts['type'] == 'news_grid') { $column = $column > 0 || $column < 4 ? $column : 4; switch ($column) { case 2: $main_class = 'grid two_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span6 column'; $excerpt_lenth = 150; $width = $img_sizes['blog_layout3'][0]; $height = $img_sizes['blog_layout3'][1]; break; case 3: $main_class = 'grid three_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span4 column'; $excerpt_lenth = 150; $width = $img_sizes['blog_layout4'][0]; $height = $img_sizes['blog_layout4'][1]; break; case 4: $main_class = 'grid four_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span3 column'; $excerpt_lenth = 115; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; default: $main_class = 'grid four_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span3 column'; $excerpt_lenth = 115; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; } } else { if ($atts['type'] == 'news_list') { switch ($thumb) { case 'small': $main_class = 'list small_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['small_post_list'][0]; $height = $img_sizes['small_post_list'][1]; break; default: $main_class = 'list small_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['small_post_list'][0]; $height = $img_sizes['small_post_list'][1]; break; } } } if ($caption != '') { $out .= ' <div class="blog_header">'; $out .= ' <h4 class="pull-left caption">'; $out .= ' ' . $caption; $out .= ' </h4>'; $out .= ' <h6 class="pull-left tagline">'; $out .= ' ' . $tagline; $out .= ' </h6>'; $out .= ' <div class="clearboth">'; $out .= ' </div>'; $out .= ' </div><!-- /.blog_header-->'; } $filter_args = array('width' => $width, 'height' => $height, 'img_class' => $img_class, 'link_class' => 'blog_sc_image_load', 'preload' => true, 'post_content' => $post_content, 'disable' => $disable, 'column' => $column, 'thumb' => $thumb, 'type' => $atts['type'], 'shortcode' => true, 'echo' => false); $out .= $atts['type'] == 'news_grid' ? '<div class="sc_layout ' . $main_class . '"><div class="row-fluid">' : '<ul class="blogging ' . $main_class . '">'; $spans_in_row = $column; $span_walk = 0; $row_walk = 1; while ($news_query->have_posts()) { $news_query->the_post(); $out .= $atts['type'] == 'news_grid' ? '<div class="' . $column_class . ' im-transform im-animate-element fade-in">' : '<li class="' . join(' ', get_post_class($post_class, get_the_ID())) . '">'; if ($atts['type'] == 'news_list') { $out .= '<div class="month pull-left">'; $out .= '<span class="day">'; $out .= '<span>'; $out .= get_the_date('M'); $out .= '</span>'; $out .= get_the_date('d'); $out .= '</span>'; $out .= '</div>'; $filter_args['disable'] .= 'image'; } $out .= miss_before_post_sc($filter_args); $out .= '<div class="' . $content_class . '">'; if (strpos($disable, 'content') === false) { $out .= '<div class="post_excerpt">'; $out .= miss_excerpt(get_the_excerpt(), $excerpt_lenth, THEME_ELLIPSIS); if (!empty($disable) && strpos($disable, 'more') === false || empty($disable)) { $out .= miss_full_read_more(); } $out .= '</div><!-- /.post_excerpt -->'; } $out .= '</div><!-- /.content -->'; $out .= $atts['type'] == 'news_grid' ? '</div>' : '</li>'; } //while $out .= $atts['type'] == 'news_grid' ? '</div></div>' : '</ul>'; } //if wp_reset_query(); return '<div class="sc-news ' . $class . $animation . '">' . $out . '</div>'; }
function _news_shortcode($args = array()) { global $post, $wp_rewrite, $wp_query, $irish_framework_params; extract($args['atts']); $out = ''; $showposts = trim($showposts); $column = !empty($column) ? trim($column) : '4'; $thumb = !empty($thumb) ? trim($thumb) : 'small'; $offset = isset($offset) ? trim($offset) : ''; $post_in = !empty($post_in) ? explode(",", trim($post_in)) : ''; $category_in = !empty($category_in) ? explode(",", trim($category_in)) : ''; $tag_in = !empty($tag_in) ? explode(",", trim($tag_in)) : ''; if (is_front_page()) { $_layout = miss_get_setting('homepage_layout'); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $template = get_post_meta($post_obj->ID, '_wp_page_template', true); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' || $template == 'templates/template-wiki.php' ? 'small_sidebar_images' : 'big_sidebar_images'); } $post_img = ''; $news_query = new WP_Query(); if (trim($pagination) == 'true') { $paged = miss_get_page_query(); $news_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'news', 'posts_per_page' => $showposts, 'paged' => $paged, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } else { $news_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'news', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } if ($news_query->have_posts()) { $img_sizes = $irish_framework_params->layout[$images]; $width = ''; $height = ''; if ($args['type'] == 'news_grid') { $column = $column > 0 || $column < 4 ? $column : 4; switch ($column) { /* case 1: $main_class = 'grid one_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span12 column'; $excerpt_lenth = 400; $width = $img_sizes['blog_layout1'][0]; $height = $img_sizes['blog_layout1'][1]; break; */ case 2: $main_class = 'grid two_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span6 column'; $excerpt_lenth = 150; $width = $img_sizes['blog_layout3'][0]; $height = $img_sizes['blog_layout3'][1]; break; case 3: $main_class = 'grid three_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span4 column'; $excerpt_lenth = 150; $width = $img_sizes['blog_layout4'][0]; $height = $img_sizes['blog_layout4'][1]; break; case 4: $main_class = 'grid four_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span3 column'; $excerpt_lenth = 115; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; default: $main_class = 'grid four_column'; $post_class = 'grid_module'; $content_class = 'content'; $img_class = 'image'; $column_class = 'span3 column'; $excerpt_lenth = 115; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; } } else { if ($args['type'] == 'news_list') { switch ($thumb) { case 'small': $main_class = 'list small_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['small_post_list'][0]; $height = $img_sizes['small_post_list'][1]; break; /* case 'medium': $main_class = 'medium_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['medium_post_list'][0]; $height = $img_sizes['medium_post_list'][1]; break; case 'large': $main_class = 'large_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['large_post_list'][0]; $height = $img_sizes['large_post_list'][1]; break; */ /* case 'medium': $main_class = 'medium_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['medium_post_list'][0]; $height = $img_sizes['medium_post_list'][1]; break; case 'large': $main_class = 'large_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['large_post_list'][0]; $height = $img_sizes['large_post_list'][1]; break; */ default: $main_class = 'list small_post_list'; $post_class = 'post_list_module'; $content_class = 'content'; $img_class = 'image'; $excerpt_lenth = 180; $width = $img_sizes['small_post_list'][0]; $height = $img_sizes['small_post_list'][1]; break; } } } if ($caption != '') { $out .= ' <div class="blog_header">'; $out .= ' <h4 class="pull-left caption">'; $out .= ' ' . $caption; $out .= ' </h4>'; $out .= ' <h6 class="pull-left tagline">'; $out .= ' ' . $tagline; $out .= ' </h6>'; $out .= ' <div class="clearboth">'; $out .= ' </div>'; $out .= ' </div><!-- /.blog_header-->'; } $filter_args = array('width' => $width, 'height' => $height, 'img_class' => $img_class, 'link_class' => 'blog_sc_image_load', 'preload' => true, 'post_content' => $post_content, 'disable' => $disable, 'column' => $column, 'thumb' => $thumb, 'type' => $args['type'], 'shortcode' => true, 'echo' => false); $out .= $args['type'] == 'news_grid' ? '<div class="sc_layout ' . $main_class . '"><div class="row-fluid">' : '<ul class="blogging ' . $main_class . '">'; $spans_in_row = $column; $span_walk = 0; $row_walk = 1; while ($news_query->have_posts()) { $news_query->the_post(); if ($spans_in_row * $row_walk == $span_walk) { $out .= '</div><!-- /.row-fluid --> <div class="row-fluid">'; } else { $out .= ''; } if ($spans_in_row * $row_walk == $span_walk) { $row_walk++; } $span_walk++; $out .= $args['type'] == 'news_grid' ? '<div class="' . $column_class . ' im-transform im-animate-element fade-in">' : '<li class="' . join(' ', get_post_class($post_class, get_the_ID())) . '">'; /* $out .= ( $args['type'] == 'news_list' ) ? '<div class="' . join( ' ', get_post_class( $post_class, get_the_ID() ) ) . '">' : '<li class="' . join( ' ', get_post_class( $post_class, get_the_ID() ) ) . '">'; */ if ($args['type'] == 'news_list') { $out .= '<div class="month pull-left">'; $out .= '<span class="day">'; $out .= '<span>'; $out .= get_the_date('M'); $out .= '</span>'; $out .= get_the_date('d'); $out .= '</span>'; $out .= '</div>'; $filter_args['disable'] .= 'image'; } $out .= miss_before_post_sc($filter_args); $out .= '<div class="' . $content_class . '">'; if (strpos($disable, 'content') === false) { $out .= '<div class="post_excerpt">'; $out .= miss_excerpt(get_the_excerpt(), $excerpt_lenth, THEME_ELLIPSIS); if (!empty($disable) && strpos($disable, 'more') === false || empty($disable)) { $out .= miss_full_read_more(); } $out .= '</div><!-- /.post_excerpt -->'; } $out .= '</div><!-- /.content -->'; $out .= $args['type'] == 'news_grid' ? '</div>' : '</li>'; } //while $out .= $args['type'] == 'news_grid' ? '</div></div>' : '</ul>'; } //if wp_reset_query(); return $out; }
/** * */ function miss_pagenavi($before = '', $after = '', $custom_query = array()) { global $wpdb, $wp_query, $irish_framework_params; $out = ''; if (!is_single()) { $pagenavi_options = array(); $pagenavi_options['pages_text'] = __('Page %CURRENT_PAGE% of %TOTAL_PAGES%', MISS_TEXTDOMAIN); $pagenavi_options['current_text'] = '%PAGE_NUMBER%'; $pagenavi_options['page_text'] = '%PAGE_NUMBER%'; $pagenavi_options['first_text'] = __('« First', MISS_TEXTDOMAIN); $pagenavi_options['last_text'] = __('Last »', MISS_TEXTDOMAIN); $pagenavi_options['next_text'] = '>'; $pagenavi_options['prev_text'] = '<'; $pagenavi_options['dotright_text'] = __('...', MISS_TEXTDOMAIN); $pagenavi_options['dotleft_text'] = __('...', MISS_TEXTDOMAIN); $pagenavi_options['style'] = 1; $pagenavi_options['num_pages'] = 5; $pagenavi_options['always_show'] = 0; $pagenavi_options['num_larger_page_numbers'] = 3; $pagenavi_options['larger_page_numbers_multiple'] = 10; $request = $wp_query->request; $posts_per_page = intval(get_query_var('posts_per_page')); $paged = intval(miss_get_page_query()); if (!empty($custom_query)) { $numposts = $custom_query->found_posts; if (!empty($irish_framework_params->offset) && $irish_framework_params->offset > 0 && !empty($irish_framework_params->posts_per_page) && $irish_framework_params->posts_per_page > 0) { $max_page = $custom_query->max_num_pages = ceil(($custom_query->found_posts - $irish_framework_params->offset) / $irish_framework_params->posts_per_page); } else { $max_page = $custom_query->max_num_pages; } } else { $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; } if (empty($paged) || $paged == 0) { $paged = 1; } // Define pagination type if ($max_page > $paged) { $pagniation_type = miss_get_setting('pagination_type') ? miss_get_setting('pagination_type') : 'manual'; } else { $pagniation_type = 'manual'; } $pages_to_show = intval($pagenavi_options['num_pages']); $larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']); $larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']); $pages_to_show_minus_1 = $pages_to_show - 1; $half_page_start = floor($pages_to_show_minus_1 / 2); $half_page_end = ceil($pages_to_show_minus_1 / 2); $start_page = $paged - $half_page_start; if ($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if ($end_page - $start_page != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if ($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if ($start_page <= 0) { $start_page = 1; } $larger_per_page = $larger_page_to_show * $larger_page_multiple; $larger_start_page_start = miss_n_round($start_page, 10) + $larger_page_multiple - $larger_per_page; $larger_start_page_end = miss_n_round($start_page, 10) + $larger_page_multiple; $larger_end_page_start = miss_n_round($end_page, 10) + $larger_page_multiple; $larger_end_page_end = miss_n_round($end_page, 10) + $larger_per_page; if ($larger_start_page_end - $larger_page_multiple == $start_page) { $larger_start_page_start = $larger_start_page_start - $larger_page_multiple; $larger_start_page_end = $larger_start_page_end - $larger_page_multiple; } if ($larger_start_page_start <= 0) { $larger_start_page_start = $larger_page_multiple; } if ($larger_start_page_end > $max_page) { $larger_start_page_end = $max_page; } if ($larger_end_page_end > $max_page) { $larger_end_page_end = $max_page; } if ($max_page > 1 || intval($pagenavi_options['always_show']) == 1) { $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); $out = $before . '<div class="wp-pagenavi ' . $pagniation_type . '-more paginator offset1">' . "\n"; switch (intval($pagenavi_options['style'])) { case 1: if (!empty($pages_text)) { $out .= '<!--span class="pagenavi-pages">' . $pages_text . '</span-->'; } if ($start_page >= 2 && $pages_to_show < $max_page) { $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']); $out .= '<a href="' . esc_url(get_pagenum_link()) . '" class="first" title="' . $first_page_text . '">' . $first_page_text . '</a>'; if (!empty($pagenavi_options['dotleft_text'])) { $out .= '<span class="extend">' . $pagenavi_options['dotleft_text'] . '</span>'; } } if ($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) { for ($i = $larger_start_page_start; $i < $larger_start_page_end; $i += $larger_page_multiple) { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']); $out .= '<a href="' . esc_url(get_pagenum_link($i)) . '" class="pagenavi-page" title="' . $page_text . '">' . $page_text . '</a>'; } } $out .= get_previous_posts_link($pagenavi_options['prev_text']); for ($i = $start_page; $i <= $end_page; $i++) { if ($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']); $out .= '<span class="current">' . $current_page_text . '</span>'; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']); $out .= '<a href="' . esc_url(get_pagenum_link($i)) . '" class="pagenavi-page" title="' . $page_text . '">' . $page_text . '</a>'; } } if ($pagniation_type == 'auto' && $max_page > $paged) { $out .= get_next_posts_link($pagenavi_options['next_text'], $max_page); } if ($larger_page_to_show > 0 && $larger_end_page_start < $max_page) { for ($i = $larger_end_page_start; $i <= $larger_end_page_end; $i += $larger_page_multiple) { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']); $out .= '<a href="' . esc_url(get_pagenum_link($i)) . '" class="pagenavi-page" title="' . $page_text . '">' . $page_text . '</a>'; } } if ($end_page < $max_page) { if (!empty($pagenavi_options['dotright_text'])) { $out .= '<span class="extend">' . $pagenavi_options['dotright_text'] . '</span>'; } $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']); $out .= '<a href="' . esc_url(get_pagenum_link($max_page)) . '" class="last" title="' . $last_page_text . '">' . $last_page_text . '</a>'; } break; case 2: $out .= '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="get">' . "\n"; $out .= '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">' . "\n"; for ($i = 1; $i <= $max_page; $i++) { $page_num = $i; if ($page_num == 1) { $page_num = 0; } if ($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']); $out .= '<option value="' . esc_url(get_pagenum_link($page_num)) . '" selected="selected" class="current">' . $current_page_text . "</option>\n"; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']); $out .= '<option value="' . esc_url(get_pagenum_link($page_num)) . '">' . $page_text . "</option>\n"; } } $out .= "</select>\n"; $out .= "</form>\n"; break; } $out .= '</div>' . $after . "\n"; if ($pagniation_type == 'auto' && $max_page > $paged) { //$out .= miss_automore_script(); //$out .= miss_automore_print_script( $echo = false, $selector = 'section.main_content', $navSelector = '.auto-more', $nextSelector = 'a.next-page', $itemSelector = '.loop_module', $isotope = false ); $out .= ' <script> jQuery(document).ready(function(){ /* Likes */ jQuery(".miss_hearts").click( function() { //var permalink = jQuery(this).attr("href"); var post_id = jQuery(this).attr("data-id"), el = jQuery(this); jQuery.ajax({ type: \'POST\', dataType: \'json\', data: { \'miss-like\': 1, \'post_id\': post_id }, beforeSend: function(x) { if(x && x.overrideMimeType) { x.overrideMimeType(\'application/json;charset=UTF-8\'); } }, complete: function() { }, success: function(data) { el.find(".number").text( data.response.count ); if ( data.response.state === "dislike" ) { el.removeClass("active"); el.find("i").attr("class", "fa-icon-heart-empty icon"); } else { el.addClass("active"); el.find("i").attr("class", "fa-icon-heart icon"); } } }); return false; } ); /* Pretty photo */ jQuery("a[rel^=\'prettyPhoto\'], a[rel^=\'lightbox\']").prettyPhoto({ overlay_gallery: false, social_tools: \'\', deeplinking: false, \'theme\': \'light_rounded\' }); }); </script>'; } // if ( $pagniation_type == 'semi' ) { // $out .= miss_automore_print_script( $echo = false, $selector = 'section.main_content', $navSelector = '.auto-more', $nextSelector = 'a.next-page' ); // } } } return $out; }
function _staff_shortcode($args = array()) { global $post, $wp_rewrite, $wp_query, $irish_framework_params; extract($args['atts']); $out = ''; $showposts = trim($showposts); $column = !empty($column) ? trim($column) : '3'; $thumb = !empty($thumb) ? trim($thumb) : 'medium'; $offset = isset($offset) ? trim($offset) : ''; $post_in = !empty($post_in) ? explode(",", trim($post_in)) : ''; $category_in = !empty($category_in) ? explode(",", trim($category_in)) : ''; $tag_in = !empty($tag_in) ? explode(",", trim($tag_in)) : ''; if (is_front_page()) { $_layout = miss_get_setting('homepage_layout'); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $template = get_post_meta($post_obj->ID, '_wp_page_template', true); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' || $template == 'templates/template-wiki.php' ? 'small_sidebar_images' : 'big_sidebar_images'); } $post_img = ''; $staff_query = new WP_Query(); if (trim($pagination) == 'true') { $paged = miss_get_page_query(); $staff_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'staff', 'posts_per_page' => $showposts, 'paged' => $paged, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } else { $staff_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'staff', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1)); } if ($staff_query->have_posts()) { $img_sizes = $irish_framework_params->layout[$images]; $width = ''; $height = ''; if ($args['type'] == 'staff_grid') { $column = $column > 0 || $column < 4 ? $column : 4; switch ($column) { case 1: $main_class = 'grid one_column staff'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'image'; $excerpt_lenth = 400; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; case 2: $main_class = 'grid two_column staff'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'image'; $column_class = 'span6'; $excerpt_lenth = 150; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; case 3: $main_class = 'grid three_column staff'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'image'; $column_class = 'span4'; $excerpt_lenth = 75; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; case 4: $main_class = 'grid four_column staff'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'image'; $column_class = 'span3'; $excerpt_lenth = 10; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; default: $main_class = 'grid four_column staff'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'image'; $column_class = 'span3'; $excerpt_lenth = 10; $width = $img_sizes['blog_layout5'][0]; $height = $img_sizes['blog_layout5'][1]; break; } } if ($caption != '') { $out .= ' <div class="blog_header">'; $out .= ' <h4 class="pull-left caption">'; $out .= ' ' . $caption; $out .= ' </h4>'; $out .= ' <h6 class="pull-left tagline">'; $out .= ' ' . $tagline; $out .= ' </h6>'; $out .= ' <div class="clearboth">'; $out .= ' </div>'; $out .= ' </div><!-- /.blog_header-->'; } $filter_args = array('width' => $width, 'height' => $height, 'img_class' => $img_class, 'link_class' => 'staff_sc_image_load', 'preload' => true, 'no_link' => true, 'post_content' => $post_content, 'disable' => $disable, 'column' => $column, 'thumb' => $thumb, 'type' => $args['type'], 'shortcode' => true, 'echo' => false); $out .= $args['type'] == 'staff_grid' ? '<div class="sc_layout ' . $main_class . '"><div class="row-fluid">' : '<ul class="' . $main_class . '">'; $spans_in_row = $column; $span_walk = 0; $row_walk = 1; while ($staff_query->have_posts()) { $staff_query->the_post(); if ($spans_in_row * $row_walk == $span_walk) { $out .= '</div><!-- /.row-fluid --> <div class="row-fluid">'; } else { $out .= ''; } if ($spans_in_row * $row_walk == $span_walk) { $row_walk++; } $span_walk++; if (!empty($animation)) { $animation = ' im-transform im-animate-element ' . $animation; } $out .= $args['type'] == 'staff_list' ? '' : ($column != 1 ? '<div class="' . $column_class . $animation . '">' : ''); $out .= $args['type'] == 'staff_grid' ? '<div class="' . join(' ', get_post_class($post_class, get_the_ID())) . '">' : '<li class="' . join(' ', get_post_class($post_class, get_the_ID())) . '">'; if (in_array('post_list_image', $filter_args)) { $filter_args = array_merge($filter_args, array('inline_width' => true)); } if (strpos($filter_args['disable'], 'image') === false) { // $image = miss_get_post_image( $filter_args ); // $out .= str_replace( array( '<a', '</a' ), array( '<span', '</span' ), $image) ; $out .= miss_get_post_image($filter_args); } if (strpos($filter_args['disable'], 'title') === false) { $out .= $title = the_title('<h2 class="post_title">', '</h2>', false); } if (strpos($filter_args['disable'], 'meta') === false) { $out .= miss_post_meta_diferent($filter_args); } $out .= '<div class="employee_position">' . get_post_meta(get_the_id(), 'position', true) . '</div>'; $out .= '<div class="' . $content_class . '">'; $out .= '<div class="post_excerpt">'; if (strpos($disable, 'content') === false) { $out .= miss_excerpt(get_the_excerpt(), 115, THEME_ELLIPSIS); if (!empty($disable) && strpos($disable, 'more') === false || empty($disable)) { $out .= miss_full_read_more(); } } $out .= '</div>'; // $out .= miss_after_entry_sc( $filter_args ); $sociable_pages = get_post_meta(get_the_id(), 'sociable'); foreach ($sociable_pages[0] as $key => $value) { //$out .= $key ; if ($key != '#' and $key != 'keys') { $out .= '<a class="sociable_icon" href="' . $value['link'] . '"><i class="fs-icon-' . $value['icon'] . '"></i></a>'; } } $out .= '<div class="clearboth"></div>'; $out .= '</div><!-- .post_class -->'; $out .= $args['type'] == 'staff_grid' ? '</div>' : '</li>'; $out .= $args['type'] == 'staff_list' ? '' : ($column != 1 ? '</div>' : ''); } $out .= $args['type'] == 'staff_grid' ? '</div></div>' : '</ul>'; if ($pagination == 'true') { $out .= miss_pagenavi('', '', $staff_query); } } wp_reset_query(); return $out; }
/** * */ public static function portfolio_grid($atts) { if ($atts == 'generator') { $option = array('name' => __('Portfolio Grid', MISS_ADMIN_TEXTDOMAIN), 'value' => 'portfolio_grid', 'options' => array(array('name' => __('Number of Columns', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of columns you would like your posts to display in.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'column', 'default' => '', 'options' => array('1' => __('One Column', MISS_ADMIN_TEXTDOMAIN), '2' => __('Two Column', MISS_ADMIN_TEXTDOMAIN), '3' => __('Three Column', MISS_ADMIN_TEXTDOMAIN), '4' => __('Four Column', MISS_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Number of Portfolio Posts', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of posts you would like to display on each page.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'showposts', 'default' => '', 'options' => array_combine(range(1, 40), array_values(range(1, 40))), 'type' => 'select'), array('name' => __('Portfolio Categories <small>(optional)</small>', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Select which portfolio categories you would like to display.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'cat', 'default' => array(), 'target' => 'portfolio_category', 'type' => 'select'), array('name' => __('Offset Portfolio Posts <small>(optional)</small>', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('This will skip a number of posts at the beginning.<br /><br />Useful if you are using multiple portfolio shortcodes on the same page.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'offset', 'default' => '', 'options' => array_combine(range(1, 10), array_values(range(1, 10))), 'type' => 'select'), array('name' => __('Disable Portfolio Elements <small>(optional)</small>', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('You can hide certain elements from displaying here.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'disable', 'options' => array('image' => __('Disable Post Image', MISS_ADMIN_TEXTDOMAIN), 'title' => __('Disable Post Title', MISS_ADMIN_TEXTDOMAIN), 'excerpt' => __('Disable Post Excerpt', MISS_ADMIN_TEXTDOMAIN), 'date' => __('Disable Date', MISS_ADMIN_TEXTDOMAIN), 'more' => __('Disable Read More', MISS_ADMIN_TEXTDOMAIN), 'visit' => __('Disable Visit Site', MISS_ADMIN_TEXTDOMAIN), 'pagination' => __('Disable Pagination', MISS_ADMIN_TEXTDOMAIN)), 'default' => '', 'type' => 'checkbox'), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('column' => '4', 'showposts' => '8', 'cat' => array(), 'offset' => '', 'disable' => ''), $atts)); $out = ''; $portfolio_query = new WP_Query(); if (isset($cat)) { global $post, $wp_rewrite, $wp_query, $irish_framework_params; $column = trim($column); $showposts = trim($showposts); // $cat = trim( $cat ); $offset = trim($offset); if (is_front_page()) { $_layout = miss_get_setting('homepage_layout'); // $images = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) ); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); // $images = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) ); } $paged = miss_get_page_query(); $gallery_post = $post->post_name; if ($post->post_parent) { $parent_query = get_post($post->post_parent); $gallery_parent = $parent_query->ID; } if (is_numeric($offset) && strpos($disable, 'pagination') === false) { $irish_framework_params->offset = $offset; $irish_framework_params->posts_per_page = $showposts; add_filter('post_limits', 'my_post_limit'); } if (strpos($disable, 'pagination') === false) { $args = array('post_type' => 'portfolio', 'posts_per_page' => $showposts, 'taxonomy' => 'portfolio_category', 'term' => $cat, 'offset' => $offset, 'paged' => $paged); } else { $args = array('post_type' => 'portfolio', 'showposts' => $showposts, 'taxonomy' => 'portfolio_category', 'term' => $cat, 'offset' => $offset, 'nopaging' => 0); } if (isset($cat) && !empty($cat)) { $args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat)); } $portfolio_query = new WP_Query(); $portfolio_query->query($args); } if ($portfolio_query->have_posts()) { $img_sizes = $irish_framework_params->layout['big_sidebar_images']; $img_group = 'portfolio_img_group_' . rand(1, 1000); $width = ''; $height = ''; switch ($column) { case 1: $column_class = 'span12 has_preview'; $width = $img_sizes['span12'][0]; $height = $img_sizes['span12'][1]; break; case 2: $column_class = 'span6 has_preview'; $width = $img_sizes['span6'][0]; $height = $img_sizes['span6'][1]; break; case 3: $column_class = 'span4 has_preview'; $width = $img_sizes['span4'][0]; $height = $img_sizes['span4'][1]; break; case 4: $column_class = 'span3 has_preview'; $width = $img_sizes['span3'][0]; $height = $img_sizes['span3'][1]; break; } $main_class = 'loop_module works portfolio row-fluid'; $out .= '<div class="' . $main_class . '">'; $i = 1; while ($portfolio_query->have_posts()) { $portfolio_query->the_post(); $id = get_the_ID(); $custom_fields = get_post_custom($id); foreach ($custom_fields as $key => $value) { ${$key}[$id] = $value[0]; if (is_serialized(${$key}[$id])) { ${$key}[$id] = unserialize(${$key}[$id]); } } if (has_post_thumbnail() || !empty($_image[$id]) || !empty($_featured_video[$id])) { if (has_post_thumbnail()) { $img = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'full', true); } else { $img[0] = !empty($_image[$id]) ? $_image[$id] : ''; } if ($wp_rewrite->using_permalinks()) { $url = home_url('/') . 'portfolio/' . $post->post_name . '/gallery/' . $gallery_post . '/'; } else { $url = htmlspecialchars(add_query_arg(array('gallery' => $gallery_post), get_permalink($id))); } $link_to = empty($_post[$id][0]) ? empty($_featured_video[$id]) ? empty($_image[$id]) ? $img[0] : $_image[$id] : $_featured_video[$id] : $url; $out .= '<div class="portfolio_item ' . ($i % $column == 0 ? $column_class . ' last' : $column_class) . ' im-transform im-animate-element scale-up">'; $out .= '<div class="' . join(' ', get_post_class('post_grid_module', get_the_ID())) . '">'; if (strpos($disable, 'image') === false) { $offset = $irish_framework_params->layout['images']['image_padding']; $load_width = $width + $offset; $load_height = $height + $offset; $out .= '<div class="post_grid_image" data-style="width:' . $load_width . 'px;">'; ob_start(); miss_portfolio_image_begin(); $out .= ob_get_clean(); if (empty($img[0]) && !empty($_featured_video[$id])) { $video_check = miss_video($args = array('url' => $_featured_video[$id], 'parse' => true, 'width' => $width, 'height' => $height)); } else { $video_check = false; } if (!empty($video_check)) { $out .= $video_check; } else { $out .= miss_display_image(array('src' => $img[0], 'alt' => '', 'title' => '', 'height' => $height, 'width' => $width, 'class' => 'hover_fade_js', 'link_to' => $link_to, 'img_class' => 'post_grid_image has_preview', 'link_class' => 'portfolio_img_load', 'prettyphoto' => empty($_post[$id][0]) ? true : false, 'group' => $img_group, 'preload' => false)); } ob_start(); miss_portfolio_image_end(array('column' => $column, 'disable' => $disable, 'date' => !empty($_date[$id]) ? $_date[$id] : '')); $out .= ob_get_clean(); $out .= '</div>'; } $out .= '<div class="first_layer color_frame">'; $out .= '<div class="second_layer sidebar_framed_caption">'; if (strpos($disable, 'title') === false) { $out .= '<div class="portfolio_item_title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></div>'; // $title = ( empty( $_more[$id][0] ) ) ? '<a href="' . esc_url( $url ) . '">' . get_the_title( $id ) . '</a>' : get_the_title( $id ); /* if( $column == 1 || $column == 2 ) $out .= '<h2 class="post_title">' . $title . '</h2>'; else $out .= '<h3 class="post_title">' . $title . '</h3>'; */ } if (strpos($disable, 'meta') === false) { $out .= '<div class="portfolio_item_meta">' . miss_post_meta_diferent(array('echo' => false)) . '</div>'; } /* if( ( !empty( $_date[$id] ) ) && ( strpos( $disable, 'date' ) === false ) ) $out .= apply_filters( 'miss_portfolio_date', '<p class="date">' . $_date[$id] . '</p>', array( 'column' => $column ) ); if( empty( $_more[$id][0] ) || !empty( $_link[$id] ) || !empty( $_teaser[$id] ) ) { $out .= '<div class="post_excerpt">'; $out .= ( ( !empty( $_teaser[$id] ) ) && ( strpos( $disable, 'excerpt' ) === false ) ) ? '<p>' . do_shortcode( $_teaser[$id] ) . '</p>' : ''; if( empty( $_more[$id][0] ) || !empty( $_link[$id] ) ) { $out .= '<p>'; */ /* if( ( empty( $_more[$id][0] ) ) && ( strpos( $disable, 'more' ) === false ) ) { $read_more = '<a href="' . esc_url( $url ) . '" class="post_more_link">' . __( 'Read More', MISS_TEXTDOMAIN ) . '</a> '; $out .= apply_filters( 'miss_portfolio_read_more', $read_more, esc_url( $url ) ); } if( ( !empty( $_link[$id] ) ) && ( strpos( $disable, 'visit' ) === false ) ) { $visit_site = '<a href="' . esc_url( $_link[$id] ) . '" class="post_more_link">' . __( 'Visit Site', MISS_TEXTDOMAIN ) . '</a>'; $out .= apply_filters( 'miss_portfolio_visit_site', $visit_site, esc_url( $_link[$id] ) ); } */ /* $out .= '</p>'; } $out .= '</div>'; } */ $out .= '</div><!-- /.second_layer-->'; $out .= '</div><!-- /.first_layer-->'; $out .= '</div>'; $out .= '</div><!-- /.portfolio_item -->'; if ($i % $column == 0) { $out .= '<div class="clearboth"></div>'; } $i++; } } $out .= '</div>'; $out .= strpos($disable, 'pagination') === false ? miss_pagenavi('', '', $portfolio_query) : ''; } else { $out .= __('No portfolio posts were found for the category selected.', MISS_TEXTDOMAIN); } if (is_numeric($offset) && strpos($disable, 'pagination') === false) { remove_filter('post_limits', 'my_post_limit'); } wp_reset_query(); //return '[raw]' . $out . '[/raw]'; return $out; }