/** * Produces the author of the post (link to author archive). * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string). * */ function calibrefx_post_author_posts_link_shortcode($atts) { global $post; $defaults = array('after' => '', 'before' => ''); $atts = shortcode_atts($defaults, $atts); $author = get_the_author_meta('ID'); $author_name = get_the_author(); if (!$author) { global $post; $author = $post->post_author; $author_name = get_the_author_meta('user_nicename', $post->post_author); } if (is_custom_post_type($post)) { $author = sprintf('<span class="fn n">%s</span>', $author_name); } else { $author = sprintf('<a href="%s" class="fn n" title="%s" rel="author">%s</a>', get_author_posts_url($author), $author_name, $author_name); } $output = sprintf('<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', $author, $atts['before'], $atts['after']); return apply_filters('calibrefx_post_author_posts_link_shortcode', $output, $atts); }
/** * fr_body_title * Outputs specific body title. * * @since 1.0.0 * @version 1.0.0 **/ function fr_body_title() { global $post, $wp_query; if (is_single()) { $output[] = get_the_title() . ' | ' . get_bloginfo('name'); } elseif (is_front_page()) { $output[] = get_bloginfo('name'); } elseif (is_page() || is_paged()) { $output[] = trim(wp_title('', false)) . ' | ' . get_bloginfo('name'); } elseif (is_author()) { $author = $wp_query->get_queried_object(); $output[] = $author->display_name . ' | ' . get_bloginfo('name'); } elseif (is_tax()) { $output[] = sprintf(__('Viewing all posts in the taxonomy: %s', 'framework'), single_term_title(null, false) . ' | ' . get_bloginfo('name')); } elseif (is_category()) { $output[] = sprintf(__('Viewing all posts in the category: %s', 'framework'), single_cat_title(null, false) . ' | ' . get_bloginfo('name')); } elseif (is_tag()) { $output[] = sprintf(__('Viewing all posts marked: %s', 'framework'), single_tag_title(null, false) . ' | ' . get_bloginfo('name')); } elseif (is_archive()) { if (is_post_type_archive()) { $posttype = $wp_query->get_queried_object(); $format = $posttype->label; } elseif (is_day()) { $format = sprintf(__('Daily Archives: %s', 'framework'), get_the_date()); } elseif (is_month()) { $format = sprintf(__('Monthly Archives: %s', 'framework'), get_the_date(_x('F Y', 'monthly archives date format'))); } elseif (is_year()) { $format = sprintf(__('Yearly Archives: %s', 'framework'), get_the_date(_x('Y', 'yearly archives date format'))); } if (!empty($format)) { $output[] = get_bloginfo('name') . ' | ' . $format; } else { $output[] = sprintf(__('Archives | %s', 'framework'), get_bloginfo('name')); } } elseif (is_custom_post_type()) { $output[] = get_the_title() . ' | ' . get_bloginfo('name'); } elseif (is_search()) { $output[] = __('Search results for: ', 'framework') . get_search_query() . ' | ' . get_bloginfo('name'); } elseif (is_404()) { $output[] = sprintf(__('404 Error | %s', 'framework'), get_bloginfo('name')); } else { $output[] = get_bloginfo('name'); } echo join($output); }
/** * @param string $sep * @return null|string */ public function get($sep = '/') { $sep = '<span class="separator">' . $sep . '</span>'; $breadcrumbs = null; $parent_page = $this->parent_page(); if (is_404()) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('page404', false))); } elseif (is_front_page()) { $breadcrumbs = null; } elseif (is_page()) { if (is_null($parent_page->url)) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('post', false))); } else { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('parent_page'), $this->bitem('post', false))); } } elseif (is_singular() && !is_page()) { if (is_custom_post_type()) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('post_type'), $this->bitem('post', false))); } else { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('category'), $this->bitem('post', false))); } } elseif (is_archive()) { if (is_tax()) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('tax', false))); } elseif (is_post_type_archive()) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('post_type', false))); } elseif (is_category()) { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('category', false))); } else { $breadcrumbs = implode($sep, array($this->bitem('main'), $this->bitem('archive', false))); } } return $breadcrumbs; }