Esempio n. 1
0
 static function load_more()
 {
     //increase the post items by one to fetch an additional item. this item is later removed by the javascript but it tells the script if there are more items to load or not
     $_POST['items'] = $_POST['items'] + 1;
     $masonry = new avia_masonry($_POST);
     $ajax = true;
     if (!empty($_POST['ids'])) {
         $masonry->query_entries_by_id(array(), $ajax);
     } else {
         $masonry->extract_terms();
         $masonry->query_entries(array(), $ajax);
     }
     $output = $masonry->html();
     echo '{av-masonry-loaded}' . $output;
     exit;
 }
Esempio n. 2
0
 /**
  * Frontend Shortcode Handler
  *
  * @param array $atts array of attributes
  * @param string $content text within enclosing form of shortcode element 
  * @param string $shortcodename the shortcode found, when == callback name
  * @return string $output returns the modified html string 
  */
 function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
 {
     $output = "";
     $params['class'] = "main_color " . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($atts['id']) ? AviaHelper::save_string($atts['id'], '-') : "";
     $params['custom_markup'] = $meta['custom_markup'];
     if ($atts['gap'] == 'no' && $atts['sort'] == "no" || $meta['index'] == 0) {
         $params['class'] .= " avia-no-border-styling";
     }
     //we dont need a closing structure if the element is the first one or if a previous fullwidth element was displayed before
     if ($meta['index'] == 0) {
         $params['close'] = false;
     }
     if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) {
         $params['close'] = false;
     }
     if ($meta['index'] != 0) {
         $params['class'] .= " masonry-not-first";
     }
     if ($meta['index'] == 0 && get_post_meta(get_the_ID(), 'header', true) != "no") {
         $params['class'] .= " masonry-not-first";
     }
     $masonry = new avia_masonry($atts);
     $masonry->extract_terms();
     $masonry->query_entries();
     $masonry_html = $masonry->html();
     if (!ShortcodeHelper::is_top_level()) {
         return $masonry_html;
     }
     $output .= avia_new_section($params);
     $output .= $masonry_html;
     $output .= avia_section_after_element_content($meta, 'after_masonry');
     return $output;
 }