/**
     * Recent Products shortcode
     *
     * @access public
     * @param array $atts
     * @return string
     */
    public function projects($atts)
    {
        global $projects_loop;
        extract(shortcode_atts(array('limit' => '12', 'columns' => '2', 'orderby' => 'date', 'order' => 'desc', 'exclude_categories' => null, 'include_children' => true), $atts));
        // Cater for fallback on false attribute
        if ($include_children === 'false') {
            $include_children = false;
        }
        // End If Statement
        $args = array('post_type' => 'project', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $limit, 'orderby' => $orderby, 'order' => $order, 'tax_query' => array(array('taxonomy' => 'project-category', 'field' => 'id', 'terms' => explode(',', $exclude_categories), 'include_children' => $include_children, 'operator' => 'NOT IN')));
        ob_start();
        $projects = new WP_Query(apply_filters('projects_query', $args, $atts));
        $projects_loop['columns'] = $columns;
        if ($projects->have_posts()) {
            ?>

			<?php 
            projects_project_loop_start();
            ?>

				<?php 
            while ($projects->have_posts()) {
                $projects->the_post();
                ?>

					<?php 
                projects_get_template_part('content', 'project');
                ?>

				<?php 
            }
            // end of the loop.
            ?>

			<?php 
            projects_project_loop_end();
            ?>

		<?php 
        }
        wp_reset_postdata();
        return '<div class="projects columns-' . $columns . '">' . ob_get_clean() . '</div>';
    }
Exemple #2
0
    /**
     * Output Projects content.
     *
     * This function is only used in the optional 'projects.php' template
     * which people can add to their themes to add basic projects support
     * without hooks or modifying core templates.
     *
     * @access public
     * @return void
     */
    function projects_content()
    {
        if (is_singular('project')) {
            while (have_posts()) {
                the_post();
                projects_get_template_part('content', 'single-project');
            }
        } else {
            ?>

			<?php 
            if (apply_filters('projects_show_page_title', true)) {
                ?>

				<h1 class="page-title"><?php 
                projects_page_title();
                ?>
</h1>

			<?php 
            }
            ?>

			<?php 
            do_action('projects_archive_description');
            ?>

			<?php 
            if (have_posts()) {
                ?>

				<?php 
                do_action('projects_before_loop');
                ?>

				<?php 
                projects_project_loop_start();
                ?>

					<?php 
                while (have_posts()) {
                    the_post();
                    ?>

						<?php 
                    projects_get_template_part('content', 'project');
                    ?>

					<?php 
                }
                // end of the loop.
                ?>

				<?php 
                projects_project_loop_end();
                ?>

				<?php 
                do_action('projects_after_loop');
                ?>

			<?php 
            } else {
                ?>

				<?php 
                projects_get_template('loop/no-products-found.php');
                ?>

			<?php 
            }
        }
    }
        ?>
						<button data-group="<?php 
        echo esc_attr($key);
        ?>
" class="btn btn--warning"><?php 
        echo esc_html($value);
        ?>
</button>
					<?php 
    }
    ?>
				</div>
				<div class="list_projects entry-content">

				<?php 
    projects_project_loop_start();
    ?>
					<?php 
    $greek_projectrows = 1;
    ?>
					<?php 
    while (have_posts()) {
        the_post();
        ?>

						<?php 
        projects_get_template_part('content', 'project');
        ?>

					<?php 
    }