Thanks for the fast response Thomas.
I added that code to the functions.php file in 'Hybrid News' but it is not displaying the extra menu link.
Is there a certain place I should have added it in? I just pasted it in right after another filter.
This is my file code:
<?php
/**
* This is your child theme's functions.php file.
* You should make edits and add additional code above this point.
* Only change the functions below if you know what you're doing.
*/
/********************************************************/
/* Constant paths. */
define( HYBRID_NEWS, get_stylesheet_directory() );
define( HYBRID_NEWS_URL, get_stylesheet_directory_uri() );
/* For localization. */
load_theme_textdomain( 'news', HYBRID_NEWS );
/* Hybrid News theme settings. */
$news_settings = get_option( 'hybrid_news_theme_settings' );
/* Include admin files. */
if ( is_admin() )
require_once( HYBRID_NEWS . '/library/admin/theme-settings.php' );
/* Actions. */
add_action( 'hybrid_head', 'news_front_page_template' );
add_action( 'wp_head', 'news_remove_actions' );
add_action( 'hybrid_before_header', 'hybrid_page_nav' );
add_action( 'hybrid_header', 'news_get_header_widget', 11 );
add_action( 'hybrid_after_header', 'news_cat_nav' );
add_action( 'hybrid_after_header', 'hybrid_breadcrumb' ); // new action added by Ian
add_action( 'hybrid_after_header', 'hybrid_search_form' ); // new action added by Ian
add_action( 'hybrid_after_container', 'news_widget_container', 11 );
add_action( 'hybrid_after_single','news_author_box' );
add_action( 'widgets_init', 'news_register_widget_areas' );
/* Filters. */
add_filter( 'hybrid_post_meta_boxes', 'news_post_meta_boxes' );
add_filter( 'hybrid_category_menu', 'custom_cat_nav' ); // new filter added by Ian
function custom_cat_nav( $menu ) {
$menu = false;
$menu = '<ul id="cat-nav" class="menu sf-menu">';
$menu .= '<li><a href="http://somelink.com">Some link</a></li>';
$menu .= wp_list_categories( array( 'depth' => 4, 'exclude' => '4,7', 'title_li' => false, 'echo' => 0 ) );
$menu .= '</ul>';
return $menu;
}
/**
* Removes default Hybrid theme actions
*
* @since 0.1
*/
function news_remove_actions() {
remove_action( 'hybrid_after_header', 'hybrid_page_nav' );
remove_action( 'hybrid_after_container', 'hybrid_get_primary' );
remove_action( 'hybrid_after_container', 'hybrid_get_secondary' );
remove_action( 'hybrid_before_content', 'hybrid_breadcrumb' ); // new action added by Ian
}
/**
* Displays the category menu.
*
* @since 0.2
*/
function news_cat_nav() {
$args = array(
'style' => 'list',
'hide_empty' => true,
'use_desc_for_title' => false,
'depth' => 4,
'hierarchical' => true,
'echo' => false, // Leave as is.
'title_li' => false, // Leave as is.
);
echo "\n\t<div id='cat-navigation'>\n\t\t";
echo '<div id="cat-nav" class="cat-nav"><ul class="menu sf-menu">' . str_replace( array( "\t", "\n", "\r" ), '', wp_list_categories( $args ) ) . '</ul></div>';
echo "\n\t</div>\n";
}
/**
* Register additional widget areas
*
* @since 0.1.1
*/
function news_register_widget_areas() {
register_sidebar( array( 'name' => __('Tertiary', 'news'), 'id' => 'tertiary', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
register_sidebar( array( 'name' => __('Utility: Header', 'news'), 'id' => 'utilityheader', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
}
/**
* Adds JavaScript and CSS to Front Page page template.
* Also removes the breadcrumb menu.
*
* @since 0.1
*/
function news_front_page_template() {
if ( is_page_template( 'front-page.php' ) ) :
wp_enqueue_script( 'slider', HYBRID_NEWS_URL . '/library/js/jquery.cycle.js', array( 'jquery' ), 0.1 );
wp_enqueue_script( 'slider-functions', HYBRID_NEWS_URL . '/library/js/jquery.functions.js', array( 'jquery' ), 0.1 );
wp_enqueue_style( 'front-page', HYBRID_NEWS_URL . '/front-page.css', false, '0.1', 'screen' );
wp_enqueue_style( 'hybrid_before_container', 'hybrid_breadcrumb' );
endif;
}
/**
* Displays the Utility: Header widget section
*
* @since 0.1
*/
function news_get_header_widget() {
if ( is_active_sidebar( 'utilityheader' ) ) :
echo '<div id="utility-header" class="utility">';
dynamic_sidebar( 'utilityheader' );
echo '</div>';
endif;
}
/**
* Wraps the Primary, Secondary, and Tertiary widget sections.
*
* @since 0.1
*/
function news_widget_container() {
if ( is_active_sidebar( 'primary' ) || is_active_sidebar( 'secondary' ) || is_active_sidebar( 'tertiary' ) ) :
echo '<div id="widget-container">';
hybrid_get_primary();
hybrid_get_secondary();
news_get_tertiary();
echo '</div>';
endif;
}
/**
* Displays the Tertiary widget section.
*
* @since 0.1
*/
function news_get_tertiary() {
if ( is_active_sidebar( 'tertiary' ) ) :
echo '<div id="tertiary">';
dynamic_sidebar( 'tertiary' );
echo '</div>';
endif;
}
/**
* Shows an author description after the post.
* Only shows on single post.
*
* @since 0.1
*/
function news_author_box() {
global $hybrid_settings;
?>
<div class="author-profile vcard">
<?php echo get_avatar( get_the_author_email(), '96', $hybrid_settings['default_avatar'] ); ?>
<h4 class="author-name fn n"><?php the_author_posts_link(); ?></h4>
<p class="author-description author-bio">
<?php the_author_description(); ?>
</p>
</div>
<?php
}
/**
* Add additional post meta boxes.
* - Feature image input box.
*
* @since 0.1
*/
function news_post_meta_boxes( $meta_boxes ) {
$meta_boxes['medium'] = array( 'name' => 'Medium', 'default' => '', 'title' => __('Medium/Feature:', 'news'), 'type' => 'text', 'show_description' => false, 'description' => false );
return $meta_boxes;
}
?>