function wp_infinite_scroll_project()
{
    $paged = $_POST['page_no'];
    $filterName = $_POST['filter_name'];
    $current_url = $_POST['current_url'];
    $page_url = basename($current_url);
    $args = array('post_type' => 'project', 'project-category' => $page_url, 'posts_per_page' => '9', 'paged' => $paged, 'post_status' => 'publish');
    $wp_query = new WP_Query($args);
    $page_id = $wp_query->get_queried_object_id();
    //var_dump($page_id);
    if ($wp_query->have_posts()) {
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            ?>


					<!-- Thumbnail -->

					<?php 
            $project_cat = '';
            $terms = get_the_terms(get_the_ID(), 'project-industry');
            if ($terms && !is_wp_error($terms)) {
                $project_cats = array();
                foreach ($terms as $term) {
                    $project_cats[] = $term->slug;
                }
                $project_cat = join(' ', $project_cats);
                ?>


					<?php 
            }
            if (!empty($terms)) {
                if (is_array($project_cats) && in_array($filterName, $project_cats) || $filterName == 'all') {
                    ?>


							<li class="thumbnail mix <?php 
                    echo $project_cat;
                    ?>
 mix_all" style="opacity: 1; display: block;">

								<a href="<?php 
                    the_permalink();
                    ?>
" >

									<?php 
                    the_post_thumbnail('project-thumb');
                    ?>


									<div class="projectinfo">

										<div class="meta">

											<h4><?php 
                    the_title();
                    ?>
</h4>

										</div>

									</div>

								</a>

							</li>

						<?php 
                } else {
                    ?>


							<li class="thumbnail mix <?php 
                    echo $project_cat;
                    ?>
 mix_all">

								<a href="<?php 
                    the_permalink();
                    ?>
" >

									<?php 
                    the_post_thumbnail('project-thumb');
                    ?>


									<div class="projectinfo">

										<div class="meta">

											<h4><?php 
                    the_title();
                    ?>
</h4>

										</div>

									</div>

								</a>

							</li>

						<?php 
                }
            }
            ?>
	

			<?php 
        }
    } else {
        ?>


			

			<!-- The very first "if" tested to see if there were any Posts to -->

			<!-- display.  This "else" part tells what do if there weren't any. -->

			<div class="no-more hidden">No More Posts To Display</div>

			

		<!--End the loop -->

		<?php 
    }
    ?>


		<?php 
    wp_reset_query();
    exit;
}
Exemple #2
0
<?php

get_header();
?>

<?php 
$filter = explode(',', $_GET['kur']);
global $wp_query;
$args = array('main_ingredient' => 'fleisch', 'tax_query' => array(array('taxonomy' => 'main_ingredient', 'field' => 'name', 'terms' => $filter, 'operator' => 'NOT IN')));
$wp_query = new WP_Query($args);
$cur_cat_id = $wp_query->get_queried_object_id();
$cur_cat = get_term($cur_cat_id);
$cat_img = get_field('main_ingredient_image', 'main_ingredient_' . $cur_cat_id);
if (!$cat_img) {
    $cat_img = get_site_url() . "/wp-content/uploads/default_cat_img.jpg";
}
$terms = get_terms(array('taxonomy' => 'main_ingredient', 'hide_empty' => true, 'parent' => $cur_cat_id));
// Get size of $terms array
$termsSize = count($terms);
?>


<main role="main">
    <!-- section -->
    <section>

        <div class="wpb_posts_slider qfRecipeCatHeader">
            <div class="qfRecipeCatImg" style="background-image: url('<?php 
echo $cat_img;
?>
');"></div>
 /**
  * @param WP_Query $wp_query
  *
  * @return array()
  */
 private function extract_tax_archive_data($wp_query)
 {
     $taxonomy = false;
     $term_id = false;
     if ($wp_query->is_category()) {
         $taxonomy = 'category';
         $term_id = $wp_query->get('cat');
     } elseif ($wp_query->is_tag()) {
         $taxonomy = 'post_tag';
         $term_id = $wp_query->get('tag_id');
     } elseif ($wp_query->is_tax()) {
         $taxonomy = $wp_query->get('taxonomy');
         $term_id = $wp_query->get_queried_object_id();
     }
     return array($taxonomy, $term_id);
 }
Exemple #4
0
 /**
  * Alternates request
  *
  * @param array $request
  * @return array
  */
 public function alter_request($request)
 {
     if (is_admin()) {
         return $request;
     }
     $mapping = array();
     foreach ($this->get_post_types() as $post_type) {
         $page_id = (int) g1_get_theme_option('post_type_' . $post_type, 'page_for_posts');
         if ($page_id) {
             $mapping[$post_type] = $page_id;
         }
     }
     foreach ($mapping as $post_type => $page_id) {
         // WPML fallback
         if (function_exists('icl_object_id')) {
             $page_id = absint(icl_object_id($page_id, 'page', true));
         }
         if ($page_id) {
             // The query isn't run if we don't pass any query vars
             $query = new WP_Query();
             $query->parse_query($request);
             // Change request from page to post type archive
             if ($query->is_page()) {
                 if (absint($query->get('page_id')) === $page_id || strlen($query->get('pagename')) && absint($query->get_queried_object_id()) === $page_id) {
                     unset($request['page']);
                     unset($request['page_id']);
                     unset($request['pagename']);
                     $request['post_type'] = $post_type;
                 }
             }
         }
     }
     return $request;
 }