/** * See Also Shortcode takes in attributes & content * content -> the title of the link desired * atts: * link_id -> name of the meta value * link_to -> which page to go to that has the iframe involved * optional: (one or the other) * current_page_id - id of the page the article is on * current_page_title - title of page the article is on */ function see_also_link_shortcode($atts, $content = null) { extract(shortcode_atts(array('link_id' => 'see-also-1', 'link_to' => 'see_also', 'current_page_id' => 0, 'current_page_title' => '', 'show_arrow' => 'true', 'class' => 'see_also_link'), $atts)); $current_page_id = get_current_page_id($current_page_id, $current_page_title); if ($current_page_id == 0) { trigger_error('No page id given outside The Loop - put this shortcode inside The Loop or ' . 'include "current_page_id" or "current_page_title" in the shortcode attributes'); } $link = get_permalink(get_page_by_path($link_to)->ID); $full_link = add_query_arg(array('parent' => $current_page_id, 'meta' => get_meta_id_by_key($current_page_id, $link_id)), $link); $return = '<p class="' . $class . '"><a href="' . $full_link . '">' . $content; if ($show_arrow != 'false') { $return .= '<span class="curvedarrow"></span>'; } $return .= '</a></p>'; return $return; }
function smarty_function_get_current_page_id($params, &$smarty) { return get_current_page_id(); }