/** * 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 = "") { extract(shortcode_atts(array('link' => ''), $atts, $this->config['shortcode'])); $output = ""; $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID(); $entry = AviaHelper::get_entry($link); if (!empty($entry)) { if ($entry->ID == $post_id) { $output .= '<article class="entry-content" ' . avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $post_id, 'custom_markup' => $meta['custom_markup'])) . '>'; $output .= "You added a Post/Page Content Element to this entry that tries to display itself. This would result in an infinite loop. Please select a different entry or remove the element"; $output .= '</article>'; } else { $output .= '<article class="entry-content" ' . avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $post_id, 'custom_markup' => $meta['custom_markup'])) . '>'; $output .= apply_filters('the_content', $entry->post_content); $output .= '</article>'; } } return do_shortcode($output); }
/** * 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 = "") { extract(shortcode_atts(array('link' => ''), $atts)); $output = ""; $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID(); $entry = AviaHelper::get_entry($link); if (!empty($entry)) { if ($entry->ID == $post_id) { $output .= "You added a Post/Page Content Element to this entry that tries to display itself. This would result in an infinite loop. Please select a different entry or remove the element"; } else { $output .= apply_filters('the_content', $entry->post_content); } } return do_shortcode($output); }