protected function onWidget(array $args, \Drone\HTML &$html) { if (($page = get_post((int) $this->wo('page'))) !== null) { if (function_exists('bbp_version') && is_bbpress()) { bbp_restore_all_filters('the_content'); } $html->add(Func::wpProcessContent($page->post_content)); } }
protected function onWidget(array $args, \Drone\HTML &$html) { if ($this->wo('description')) { $html->addNew('p')->add($this->wo_('description')->__()); } $cf = \Everything::getShortcodeOutput('contact'); $cf = str_replace('<textarea ', '<textarea class="full-width" ', $cf); $html->add($cf); }
protected function onShortcode($content, $code, \Drone\HTML &$html) { // Columns $columns_int = (int) rtrim($this->so('columns'), '+'); $columns_plus = $this->so('columns') != (string) $columns_int; // Posts $query = new \WP_Query(array('posts_per_page' => $this->so('count', '__empty', -1), 'post_status' => 'publish', 'post_type' => 'portfolio', 'post_parent' => $this->so('id', '__default', get_the_ID()), 'post__not_in' => is_single() ? array(get_the_ID()) : array(), 'orderby' => $this->so('orderby'), 'order' => $this->so('order'), 'paged' => max(get_query_var('page'), get_query_var('paged'), 1))); if (!$query->have_posts()) { return; } // Bricks $bricks = $html->addNew('div')->class('bricks')->data('bricks-columns', $columns_int)->data('bricks-filter', Func::boolToString($this->so('filter'))); while ($query->have_posts()) { $query->the_post(); $div = $bricks->addNew('div'); if ($columns_plus) { $div->addClass('one-plus'); } // Item $item = $div->addNew('article')->id('portfolio-item-' . get_the_ID())->addClass(get_post_class('portfolio-item')); if ($this->so('title') || $this->so('teaser') || $this->so('taxonomy')) { $item->addClass('bordered'); } // Terms if ($this->so('filter')) { $terms = Func::wpPostTermsList(get_the_ID(), 'portfolio-' . $this->so('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->so('image_hover'), 'fancybox' => false)))->href(get_permalink())->add(get_the_post_thumbnail(null, $columns_plus ? 'auto-2' : 'auto')); } // Title if ($this->so('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()); } // Teaser switch ($this->so('teaser')) { 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; } //$item_desc->addNew('p')->add(wp_trim_words(has_excerpt() ? get_the_excerpt() : strip_shortcodes($GLOBALS['post']->post_content), $this->so('excerpt_length'), ' […]')); // Taxonomy if ($this->so('taxonomy')) { $item_desc->add(get_the_term_list(get_the_ID(), 'portfolio-' . $this->so('taxonomy'), '<p class="small alt">', ', ', '</p>')); } } wp_reset_postdata(); // Paginate links if ($this->so('pagination') && ($pagination = \Everything::getPaginateLinks('portfolio', $query))) { $html->add($pagination); } }
protected function onShortcode($content, $code, \Drone\HTML &$html) { if ($this->so('id') && ($page = get_post((int) $this->so('id'))) !== null) { $html->add(Func::wpProcessContent($page->post_content)); } }