/** * Runs the loop on $query * @param WP_Query $query * @param array $set * @since 1.0.0 */ protected function loop($query, $set) { echo "<div id='{$this->loop_css_id}' class='ppb-custom-posts layout-{$set['layout']} {$set['layout']} {$set['text-position']} {$set['feat-img']}'>"; $this->embed_styles($set); $i = 0; while ($query->have_posts()) { $query->the_post(); $i++; $attr = array('id' => "ppb-post-{$this->id}-{$this->loop_id}-{$i}", 'class' => array('ppb-post')); echo '<article ' . pootlepb_stringify_attributes($attr) . '>'; $this->show_post($set); echo '</article>'; } echo '</div>'; }
/** * Render the Content Panel. * * @param string $widget_info The widget class name. * * @since 0.1.0 */ public function portfolio_container($info) { $set = json_decode($info['info']['style'], true); if (!empty($set['portfolio-item'])) { $attr = array(); $attr['class'] = 'ppb-portfolio-item'; $attr['style'] = ''; $this->hover_color($attr, $set); $this->hover_animation($attr, $set); $this->add_link($attr, $set); echo '<div ' . pootlepb_stringify_attributes($attr) . '>'; } }
/** * Returns the cell attributes in string * @param int $ci * @param int $gi * @param int $post_id * @param array $panels_data * @return string */ private function get_cell_attributes($ci, $gi, $post_id, $panels_data) { $cellId = 'pgc-' . $post_id . '-' . $gi . '-' . $ci; $col_class = ''; if (!empty($panels_data['grids'][$gi]['style']['col_class'])) { $col_class = $panels_data['grids'][$gi]['style']['col_class']; } $cell_classes = apply_filters('pootlepb_row_cell_classes', array("ppb-col panel-grid-cell {$col_class}"), $panels_data); $cell_attributes = array('class' => implode(' ', $cell_classes), 'id' => $cellId); $cell_attributes = apply_filters('pootlepb_row_cell_attributes', $cell_attributes, $ci, $gi, $panels_data['grids'][$gi]['style'], $panels_data); return pootlepb_stringify_attributes($cell_attributes); }
/** * Opens the content block container with styles and classes * @param $block_info * @param $gi * @param $ci * @param $pi * @param $blocks_num * @param $post_id * @action pootlepb_render_content_block * @since 0.1.0 */ public function open_block($block_info, $gi, $ci, $pi, $blocks_num, $post_id) { $styleArray = array(); if (isset($block_info['info']['style'])) { $styleArray = json_decode($block_info['info']['style'], true); } //Id for this content block $id = 'panel-' . $post_id . '-' . $gi . '-' . $ci . '-' . $pi; $attr = array('id' => $id); //Classes for this content block $attr['class'] = array('ppb-block'); if (!empty($styleArray['class'])) { $attr['class'][] = $styleArray['class']; } if (empty($styleArray['padding-mobile'])) { $attr['class'][] = 'ppb-no-mobile-spacing'; } $styleWithSelector = ''; // Passed with reference if (!empty($styleArray)) { $this->set_inline_embed_styles($attr, $styleWithSelector, $styleArray, $id); // Get Styles } if (!empty($styleWithSelector)) { echo '<style>' . $styleWithSelector . '</style>'; } echo '<div '; echo pootlepb_stringify_attributes($attr); echo '>'; }