/** * bf_nav() - Buffet Framework filter function * * Displays the main navigation on the theme, after the header. * You can override the default navigation using the <b>bf_nav</b> filter. * * * @since 0.5.2 * @hook filter bf_nav * @return string HTML code */ function bf_nav() { $output = '<div class="menu clearfix"><ul id="nav" class="nav clearfix">'; $output .= '<li><a href="' . get_bloginfo('url') . '" title="' . get_bloginfo('name') . '">' . bf_get_option('home_link') . '</a></li>'; if (!bf_get_option('topnav_linkcat')) { $output .= wp_list_categories('hierarchical=false&orderby=id&hide_empty=1&title_li=&exclude=1&echo='); } else { $output .= wp_list_bookmarks('category=' . bf_get_option('topnav_linkcat') . '&show_private=1&hide_invisible=0&title_li=&categorize=0&orderby=id&echo='); } $output .= '</ul><!-- .nav -->'; $output .= '<ul class="rss-links clearfix">'; $output .= '<li><a href="' . get_bloginfo('rss2_url') . '" rel="alternate" type="application/rss+xml" title="' . sprintf(__('%s Posts RSS Feed', 'arras'), wp_specialchars(get_bloginfo('name'), 1)) . '">'; $output .= __('Posts', 'buffet') . '</a></li>'; $output .= '<li><a href="' . get_bloginfo('comments_rss2_url') . '" rel="alternate" type="application/rss+xml" title="' . sprintf(__('%s Comments RSS Feed', 'arras'), wp_specialchars(get_bloginfo('name'), 1)) . '">'; $output .= __('Comments', 'buffet') . '</a></li>'; $output .= '</ul><!-- .rss-links --></div><!-- .menu -->'; echo apply_filters('bf_nav', $output); }
/** * {@internal Missing Short Description }} * * {@internal Missing Long Description }} * * @hook filter bf_breadcrumb_prefix * @since 0.5.2 */ function bf_add_breadcrumbs() { /* * Taken from Yoast Breadcrumb (http://yoast.com/wordpress/breadcrumbs/). * Edited it to display the breadcrumb in a unordered list for certain jQuery plugins to work. */ global $wp_query; $output = ''; $on_front = get_option('show_on_front'); $output .= '<ul class="breadcrumbs clearfix" id="breadcrumbs">'; // comment this to hide prefix notice //$prefix = apply_filters( 'bf_breadcrumb_prefix', __('You are Here:', 'buffet') ); if ($prefix != '') { $output .= '<li class="notice">' . $prefix . '</li>'; } function bf_get_category_parents($id, $link = false, $separator = '', $nicename = false) { $chain = ''; $parent =& get_category($id); if (is_wp_error($parent)) { return $parent; } if ($nicename) { $name = $parent->slug; } else { $name = $parent->cat_name; } if ($parent->parent && $parent->parent != $parent->term_id) { $chain .= '<li>' . get_category_parents($parent->parent, true, $separator, $nicename) . '</li>'; } if (is_single()) { return $chain . '<li><a href="' . get_category_link($id) . '">' . $name . '</a></li>'; } else { return $chain . '<li><strong>' . $name . '</strong></li>'; } } if ($on_front == "page") { $homelink = '<li><a href="' . get_permalink(get_option('page_on_front')) . '">' . bf_get_option('home_link') . '</a></li>'; $bloglink = $homelink . '<li><a href="' . get_permalink(get_option('page_for_posts')) . '">' . bf_get_option('blog_link') . '</a></li>'; } else { $homelink = '<li><a href="' . get_bloginfo('url') . '">' . bf_get_option('home_link') . '</a></li>'; $bloglink = $homelink; } if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) { $output .= '<li><strong>' . bf_get_option('home_link') . '</strong></li>'; } elseif ($on_front == "page" && is_home()) { $output .= $homelink . '<li><strong>' . bf_get_option('blog_link') . '</strong></li>'; } elseif (!is_page()) { $output .= $homelink; if ((is_single() || is_category() || is_tag() || is_date() || is_author()) && bf_get_option('single_parent') != false) { $output .= '<li><a href="' . get_permalink(bf_get_option('single_parent')) . '">' . get_the_title(bf_get_option('single_parent')) . '</a></li>'; } if (is_single()) { $cats = get_the_category(); $cat = $cats[0]; if ($cat->parent != 0) { $output .= bf_get_category_parents($cat->term_id, true, ""); } else { $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>'; } } if (is_category()) { $cat = intval(get_query_var('cat')); $output .= bf_get_category_parents($cat, false, ""); } elseif (is_tag()) { $output .= '<li><strong>' . single_cat_title(' ', false) . '</strong></li>'; } elseif (is_date()) { $output .= '<li><strong>' . single_month_title(' ', false) . '</strong></li>'; } elseif (is_author()) { $user = get_userdatabylogin($wp_query->query_vars['author_name']); $output .= '<li><strong>' . $user->display_name . '</strong></li>'; } elseif (is_search()) { $output .= '<li><strong>' . get_search_query() . '</strong></li>'; } else { $output .= '<li><strong>' . get_the_title() . '</strong></li>'; } } else { $post = $wp_query->get_queried_object(); // If this is a top level Page, it's simple to output the breadcrumb if (0 == $post->post_parent) { $output .= $homelink . '<li><strong>' . get_the_title() . '</strong></li>'; } else { if (isset($post->ancestors)) { if (is_array($post->ancestors)) { $ancestors = array_values($post->ancestors); } else { $ancestors = array($post->ancestors); } } else { $ancestors = array($post->post_parent); } // Reverse the order so it's oldest to newest $ancestors = array_reverse($ancestors); // Add the current Page to the ancestors list (as we need it's title too) $ancestors[] = $post->ID; $links = array(); foreach ($ancestors as $ancestor) { $tmp = array(); $tmp['title'] = strip_tags(get_the_title($ancestor)); $tmp['url'] = get_permalink($ancestor); $tmp['cur'] = false; if ($ancestor == $post->ID) { $tmp['cur'] = true; } $links[] = $tmp; } $output .= $homelink; foreach ($links as $link) { if (!$link['cur']) { $output .= '<li><a href="' . $link['url'] . '">' . $link['title'] . '</a></li>'; } else { $output .= '<li><strong>' . $link['title'] . '</strong></li>'; } } } } $output .= '</ul>'; echo $output; // return output }
get_header(); ?> <div id="content" class="section"> <?php bf_above_content(); ?> <?php bf_above_index_news(); ?> <?php wp_reset_query(); query_posts('cat=' . bf_get_option('news_cat') . '&paged=' . $paged); if (have_posts()) { ?> <div class="hfeed news-list clearfix"> <?php while (have_posts()) { the_post(); ?> <div <?php bf_post_class(); ?> > <?php bf_postheader(); ?>
/** * {@internal Missing Short Description }} * * {@internal Missing Long Description }} * * @hook action bf_admin_layout_form * @since 0.5.2 */ function bf_admin_layout_form() { ?> <h3><?php _e('Author Information', 'buffet'); ?> </h3> <table class="form-table"> <tr valign="top"> <th scope="row" colspan="2"> <?php echo bf_form_checkbox('bf-layout-display-author', 'show', bf_get_option('display_author'), 'id="bf-layout-display-author"'); ?> <label for="bf-layout-display-author"><?php _e('Display author information in single post', 'buffet'); ?> </label> </th> <td></td> </tr> </table> <?php do_action('bf_admin_layout_form'); ?> <p class="submit"> <input class="button-primary" type="submit" name="save" value="<?php _e('Save Changes', 'buffet'); ?> " /> </p> <?php }
/** * bf_get_ext_option() - Get Extension Option Function * * This function allows you to get a setting based on the ID. * * @see bf_update_ext_option() * @see bf_delete_ext_option() * @access public * @since 0.5.3 * @return string Value of the setting * @param string $ext_id ID of the extension. Usually it's the class name * @param string $opt_id ID of the extension option */ function bf_get_ext_option($ext_id, $opt_id) { $loaded_extensions = bf_get_option('extensions'); if ($loaded_extensions[$ext_id]) { return $loaded_extensions[$ext_id]['settings'][$opt_id]; } else { return false; } }
function featured_post() { $q = new WP_Query('cat=' . bf_get_option('featured_cat')); if ($q->have_posts()) { $q->the_post(); ?> <div class="featured-post clearfix"> <?php echo '<span class="entry-category">' . __('Featured Post', 'buffet') . '</span>'; echo '<h4 class="entry-title"><a title="' . sprintf(__('Permalink to %s', 'buffet'), get_the_title()) . '" href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h4>'; ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <a class="more-link" href="<?php the_permalink(); ?> "><?php _e('Read More', 'buffet'); ?> </a> </div> <?php } }
<?php bf_above_footer(); ?> </div><!-- #main --> <div id="footer"> <div class="footer-message"> <?php echo stripslashes(bf_get_option('footer_message')); ?> </div> </div><!-- #footer --> <?php wp_footer(); ?> <?php bf_footer(); ?> </div><!-- #wrapper --> </body> </html>