Beispiel #1
0
 public function loadmore_posts()
 {
     $load_count = intval(sup_isset($_POST, 'load_count'));
     $post_type = sup_isset('post_type', $_POST);
     $posts_per_page = get_option('posts_per_page');
     $offset = $load_count == 1 ? $posts_per_page * $load_count + 1 : $posts_per_page * $load_count;
     $markup = '';
     switch ($post_type) {
         case 'main':
             $markup = $this->get_latest_posts($offset, $posts_per_page);
             break;
         case 'popular':
             $markup = $this->get_popular_posts($offset, $posts_per_page);
             break;
         case 'recommended':
             $markup = $this->get_recommeded_posts($offset, $posts_per_page);
             break;
     }
     wp_send_json(array('markup' => $markup));
 }
Beispiel #2
0
        } elseif (sup_isset($slide, 'thumbnail_src')) {
            printf("<img src='%s' alt='%s'>", esc_url($slide['thumbnail_src']), esc_attr(sup_isset($slide, 'title')));
        }
        ?>

			<?php 
        if (sup_isset($slide, 'title') || sup_isset($slide, 'excerpt')) {
            ?>
			<div class="sup-slide-content">
				<?php 
            if (sup_isset($slide, 'title')) {
                printf('<h2 class="slide-title" ><a href="%s">%s</a></h2>', esc_url($link), esc_html($slide['title']));
            }
            ?>
				<?php 
            if (sup_isset($slide, 'excerpt')) {
                $sidebar_excerpt = sup_trim_characters(wp_strip_all_tags($slide['excerpt']), 80, '..');
                printf('<p class="slide-excerpt" data-sidebar-excerpt="%s"><a href="%s">%s</a></p>', esc_attr($sidebar_excerpt), esc_url($link), esc_html($slide['excerpt']));
            }
            ?>
			</div>
			<?php 
        }
        ?>

		</div>
		<?php 
    }
    ?>
	</div>
	<div class="sup-cycle-pager clearfix"></div>