function load_posts() { $post_offset = $_POST['post_offset']; $args = array('numberposts' => -1, 'post_type' => 'post', 'offset' => $post_offset); $posts = new WP_Query($args); project_card($posts); die; }
function load_projects() { $post_offset = $_POST['post_offset']; $projects_status = $_POST['projects_status']; $ideas = array('numberposts' => -1, 'post_type' => 'project', 'meta_key' => 'project_status', 'meta_value' => 'Pomysł', 'offset' => $post_offset); $in_progress = array('numberposts' => -1, 'post_type' => 'project', 'meta_key' => 'project_status', 'meta_value' => 'W trakcie realizacji', 'offset' => $post_offset); $finished = array('numberposts' => -1, 'post_type' => 'project', 'meta_query' => array('relation' => 'OR', array('key' => 'project_status', 'value' => 'Ukończony'), array('key' => 'project_status', 'value' => 'W ciągłym doskonaleniu')), 'offset' => $post_offset); if ($projects_status == 'ideas') { $projects = new WP_Query($ideas); } else { if ($projects_status == 'in_progress') { $projects = new WP_Query($in_progress); } else { if ($projects_status == 'finished') { $projects = new WP_Query($finished); } } } project_card($projects); die; }
<?php /* Template Name: Główna */ global $snrg_option_global; ?> <?php get_header(); get_template_part('parts/topbar'); get_template_part('parts/hero'); // args $projects = array('posts_per_page' => 3, 'post_type' => 'project', 'orderby' => 'modified'); $projects_query = new WP_Query($projects); ?> <div class="compensator"> <div class="cardsWrapper showcase"> <?php project_card($projects_query); ?> </div> </div> <?php get_template_part('parts/sponsors'); ?> <!-- end content container --> <?php get_footer();
<a class="link link--tab" href="#in_progress">Realizowane (<?php echo get_number_of_projects($current_member, 'in_progress'); ?> )</a> </li> </ul> <div class="tab"> <div id="finished" class="tab__content"> <div class="cardsWrapper"> <?php if ($finished_projects->have_posts()) { project_card($finished_projects); } else { echo '<p class="emptyState">Brak ukończonych projektów</p>'; } ?> <!-- UKOŃCZONE END --> </div> </div> <div id="in_progress" class="tab__content"> <?php if ($in_progress_projects->have_posts()) { project_card($in_progress_projects); } else { echo '<p class="emptyState">Brak realizowanych projektów</p>'; } ?> </div> </div>
<ul class="tabsMenu"> <li id="tabsReset" class="tabsMenu__item tabsMenu__item--current"> <a class="link link--tab" href="#posts">Wpisy</a> </li> <li class="tabsMenu__item"> <a class="link link--tab" href="#archive">Archiwum</a> </li> <li class="tabsMenu__item"> <a class="link link--tab" href="#tags">Tagi</a> </li> </ul> <div class="tab"> <div class="tab__content" id="posts"> <div class="cardsWrapper"> <?php project_card($posts); ?> </div> <button id="load_more_posts" class="btn btn--loadMore btn--synergia">Zobacz starsze</div></button> </div> <div class="tab__content" id="archive"> <?php get_template_part('parts/archive'); ?> </div> <div class="tab__content" id="tags"> <?php $tags = My_TagCloud(array('wrapper' => 'div')); if ($tags) { echo $tags; } else {
project_card($in_progress_query); ?> </div> </div> <?php // Ukończone ?> <div class="tab__content" id="finished_projects" data-projects-status="finished" data-total="<?php echo $done_query->found_posts; ?> "> <div class="cardsWrapper"> <?php project_card($done_query); ?> </div> <button id="load_more" class="btn btn--loadMore btn--synergia">Zobacz starsze</div></button> </div> </div> </div> <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?> <?php get_footer();