' . __('RSS Feeds', THEME_NS) . ''; } // ads function theme_advertisement($atts) { extract(shortcode_atts(array( 'code' => 1, 'align' => 'left', 'inline' => 0 ), $atts)); $ad = theme_get_option('theme_ad_code_' . $code); if (!empty($ad)): $ad = '
[ad] ' . sprintf(__("Empty ad slot (#%s)!", THEME_NS), esc_attr($code)) . '
'; endif; } function theme_go_to_top() { return sprintf('' . __('Top', THEME_NS) . ''); } // login function theme_login_link() { if (is_user_logged_in()) return sprintf('%2$s', admin_url(), __('Site Admin', THEME_NS)); else return sprintf('%2$s', wp_login_url(), __('Log in', THEME_NS)); } // blog title function theme_blog_title() { return '' . get_bloginfo('name') . ''; } // validate xhtml function theme_validate_xhtml() { return 'XHTML 1.1'; } // validate css function theme_validate_css() { return 'CSS 3.0'; } // current year function theme_current_year() { return date('Y'); } function theme_rss_url() { return get_bloginfo('rss2_url', 'raw'); } function theme_rss_title() { return sprintf(__('%s RSS Feed', THEME_NS), get_bloginfo('name')); } function theme_template_url() { return get_bloginfo('template_url', 'display'); } function theme_post_link($atts) { extract(shortcode_atts(array( 'name' => '/' ), $atts)); $raw_name = $name; $type = 'page'; if(strpos($name, '/Blog%20Posts/') === 0) { $name = substr($name, strlen('/Blog%20Posts/')); $type = 'post'; } $target = get_page_by_path($name, OBJECT, $type); if(null !== $target) { return get_permalink($target->ID); } else { return $raw_name; } } function theme_search() { theme_ob_start(); get_search_form(); return theme_ob_get_clean(); } function theme_collage($atts) { extract(shortcode_atts(array( 'id' => '' ), $atts)); $page_id = get_queried_object_id(); $collages = get_post_meta($page_id, 'theme_collages', true); return $collages[$id]; } add_shortcode('year', 'theme_current_year'); add_shortcode('rss', 'theme_subscribe_rss'); add_shortcode('ad', 'theme_advertisement'); add_shortcode('top', 'theme_go_to_top'); add_shortcode('login_link', 'theme_login_link'); add_shortcode('blog_title', 'theme_blog_title'); add_shortcode('xhtml', 'theme_validate_xhtml'); add_shortcode('css', 'theme_validate_css'); add_shortcode('rss_url', 'theme_rss_url'); add_shortcode('rss_title', 'theme_rss_title'); add_shortcode('template_url', 'theme_template_url'); add_shortcode('post_link', 'theme_post_link'); add_shortcode('search', 'theme_search'); add_shortcode('collage', 'theme_collage'); add_filter('widget_text', 'do_shortcode'); // Allow [SHORTCODES] in Widgets ?>