Exemple #1
0
 protected function onWidget(array $args, \Drone\HTML &$html)
 {
     $html = \Drone\HTML::div()->style("height: {$this->wo('height')}px;")->add($html = \Drone\HTML::div()->class('fb-like-box')->data('href', $this->wo('href'))->data('height', $this->wo('height'))->data('header', \Drone\Func::boolToString($this->wo('header')))->data('stream', \Drone\Func::boolToString($this->wo('stream')))->data('show-faces', \Drone\Func::boolToString($this->wo('show_faces')))->data('show-border', \Drone\Func::boolToString($this->wo('border'))));
 }
Exemple #2
0
 * @package    WordPress
 * @subpackage Everything
 * @since      1.0
 */
?>

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

	<section class="section">
		<div class="bricks alt-mobile" data-bricks-columns="<?php 
    echo Everything::to('site/blog/columns');
    ?>
" data-bricks-filter="<?php 
    echo \Drone\Func::boolToString($filter = Everything::to('site/blog/filter/filter', '__hidden'));
    ?>
">
			<?php 
    while (have_posts()) {
        the_post();
        ?>
				<?php 
        if ($filter) {
            $terms = \Drone\Func::wpPostTermsList(get_the_ID(), $filter);
            if (is_category() && ($term_id = array_search(single_cat_title('', false), $terms)) !== false) {
                unset($terms[$term_id]);
            }
            $terms = esc_attr(json_encode(array_values($terms)));
        }
        ?>
Exemple #3
0
 protected function getBricks($query)
 {
     // HTML
     $html = HTML::div()->class('bricks')->data('bricks-columns', $this->so('columns'))->data('bricks-filter', Func::boolToString($this->so('filter')));
     while (have_posts()) {
         the_post();
         $GLOBALS['more'] = 0;
         $brick = $html->addNew('div')->add(\Drone\Func::functionGetOutputBuffer('get_template_part', 'parts/post'));
         if ($this->so('filter')) {
             $terms = \Drone\Func::wpPostTermsList(get_the_ID(), $this->so('filter'));
             if (is_category() && ($term_id = array_search(single_cat_title('', false), $terms)) !== false) {
                 unset($terms[$term_id]);
             }
             $brick->data('bricks-terms', json_encode(array_values($terms)));
         }
     }
     wp_reset_query();
     // Paginate links
     if ($this->so('pagination') && ($pagination = \Everything::getPaginateLinks('blog', $query))) {
         $html = HTML::make()->add($html, $pagination);
     }
     return $html;
 }
Exemple #4
0
 protected function _html()
 {
     $html = HTML::div()->class($this->getCSSClass(__CLASS__))->data('sortable', Func::boolToString($this->sortable))->data('index-prefix', $this->index_prefix);
     $ol = $html->addNew('ol')->class('items');
     foreach ($this->options as $option) {
         $ol->addNew('li')->add(HTML::div()->add($option->html()), HTML::a()->class('button delete')->add(__('Delete', $this->domain)));
     }
     $html->addNew('div')->class('prototype')->add(HTML::div()->add($this->prototype->html()), HTML::a()->class('button delete')->add(__('Delete', $this->domain)));
     $html->addNew('div')->class('controls')->addNew('a')->class('button add')->add(__('Add new', $this->domain));
     return $html;
 }
Exemple #5
0
 protected function onWidget(array $args, \Drone\HTML &$html)
 {
     if (!$this->wo('id')) {
         return;
     }
     // Columns
     $columns_int = (int) rtrim($this->wo('columns'), '+');
     $columns_plus = $this->wo('columns') != (string) $columns_int;
     // Posts
     $query = new \WP_Query(array('posts_per_page' => $this->wo('count', '__empty', -1), 'post_status' => 'publish', 'post_type' => 'portfolio', 'post_parent' => $this->wo('id'), 'post__not_in' => is_single() ? array(get_the_ID()) : array(), 'orderby' => $this->wo('orderby'), 'order' => $this->wo('order')));
     if (!$query->have_posts()) {
         return;
     }
     // Bricks
     $bricks = $html->addNew('div')->class('bricks')->data('bricks-columns', $columns_int)->data('bricks-filter', Func::boolToString($this->wo('filter')));
     while ($query->have_posts()) {
         $query->the_post();
         $div = $bricks->addNew('div');
         // Item
         $item = $div->addNew('article')->id('portfolio-item-' . get_the_ID())->addClass(get_post_class('portfolio-item'));
         if ($this->wo('show_title') || $this->wo('content') || $this->wo('taxonomy')) {
             $item->addClass('bordered');
         }
         // Relation
         if ($this->wo('filter')) {
             $terms = Func::wpPostTermsList(get_the_ID(), 'portfolio-' . $this->wo('filter'));
             if (count($terms) > 0) {
                 $div->data('bricks-terms', json_encode(array_values($terms)));
             }
         }
         // Columns +
         if ($columns_plus) {
             $ul = $item->addNew('div')->class('columns')->addNew('ul');
             $item_featured = $ul->addNew('li')->class('col-2-3');
             $item_desc = $ul->addNew('li')->class('col-1-3');
         } else {
             $item_featured = $item_desc = $item;
         }
         // Featured image
         if (has_post_thumbnail()) {
             $item_featured->addNew('figure')->class('thumbnail featured full-width')->addNew('a')->attr(\Everything::getImageAttrs('a', array('border' => false, 'hover' => $this->wo('image_hover'), 'fancybox' => false)))->href(get_permalink())->add(get_the_post_thumbnail(null, $columns_plus ? 'auto-2' : 'auto'));
         }
         // Title
         if ($this->wo('show_title')) {
             $item_desc->addNew($columns_int == 1 ? 'h2' : 'h3')->addNew('a')->href(get_permalink())->title(the_title_attribute(array('echo' => false)))->add(get_the_title());
         }
         // Content
         switch ($this->wo('content/content', '__hidden')) {
             case 'excerpt':
                 $item_desc->addNew('p')->add(get_the_excerpt());
                 break;
             case 'excerpt_content':
                 if (has_excerpt()) {
                     $item_desc->addNew('p')->add(get_the_excerpt());
                     break;
                 }
             case 'content':
                 $GLOBALS['more'] = 0;
                 $item_desc->add(\Drone\Func::wpProcessContent(get_the_content(\Everything::getReadMore())));
                 break;
         }
         // Taxonomy
         if ($this->wo('taxonomy/visible')) {
             $item_desc->add(get_the_term_list(get_the_ID(), 'portfolio-' . $this->wo('taxonomy/taxonomy'), '<p class="small alt">', ', ', '</p>'));
         }
     }
     wp_reset_postdata();
 }