/**
     * 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>';
    }
Esempio n. 2
0
	<?php 
/**
 * projects_before_main_content hook
 *
 * @hooked projects_output_content_wrapper - 10 (outputs opening divs for the content)
 */
do_action('projects_before_main_content');
?>

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

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

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

	<?php 
/**
 * projects_after_main_content hook
 *
 * @hooked projects_output_content_wrapper_end - 10 (outputs closing divs for the content)
 */
do_action('projects_after_main_content');
?>
 /**
  * Display the widget on the frontend.
  * @since  1.0.0
  * @param  array $args     Widget arguments.
  * @param  array $instance Widget settings for this instance.
  * @return void
  */
 public function widget($args, $instance)
 {
     $cache = wp_cache_get('widget_projects_items', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args, EXTR_SKIP);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $args = array();
     /* Display the widget title if one was input (before and after defined by themes). */
     if ($title) {
         $args['title'] = $title;
     }
     /* Widget content. */
     // Add actions for plugins/themes to hook onto.
     do_action($this->projects_widget_cssclass . '_top');
     // Integer values.
     if (isset($instance['limit']) && 0 < count($instance['limit'])) {
         $args['limit'] = intval($instance['limit']);
     }
     // Display the projects.
     $args = array('post_type' => 'project', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $args['limit'], 'orderby' => 'date', 'order' => 'DESC');
     $r = new WP_Query($args);
     if ($r->have_posts()) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="projects_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             projects_get_template_part('content', 'project-widget');
         }
         echo '</ul>';
         echo $after_widget;
         wp_reset_postdata();
     }
     // Add actions for plugins/themes to hook onto.
     do_action($this->projects_widget_cssclass . '_bottom');
     $cache[$widget_id] = ob_get_flush();
     wp_cache_set('widget_projects_items', $cache, 'widget');
 }
Esempio n. 4
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 
            }
        }
    }
Esempio n. 5
0
				</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 
    }
    // end of the loop.
    ?>

				<?php 
    projects_project_loop_end();
    ?>

				</div><!-- .projects -->

				<?php 
    /**