Welcome, guest!

Feel free to read the blog, browse for themes, or join the club.

Customizations to Hybrid News - How to do it Properly?

  1. Justin,

    At this thread: http://themehybrid.com/support/topic/download-version-071-of-hybrid#post-34266

    You stated:

    "It is the incorrect way to upgrade. You should delete the entire /hybrid folder and upload a fresh copy.

    If you're making any changes to the files in the Hybrid theme, you're only going to hurt yourself in the long run. Open a new topic with specific questions on things you'd like to add to the header, and I'll be happy to help you with implementing them correctly."

    I have a customized version of Hybrid News which I call "Hybrid Beach." You can see an example at http://buildingfromnothing.com/

    Actually there are a few versions of Hybrid Beach but I will use one example.

    I did some of the customizations myself, and later an outsourcer did a few more for me.

    Here is the short version of what was changed:

    Files changed in Hybrid Parent theme:

    functions.php
    header.php
    hooks-filters.php
    style.css

    (All other changes were to Hybrid News, now renamed "Hybrid Beach 3").

    Here is the long version (if needed)

    The changes I made to the Hybrid parent theme (last spring):

    • Replaced the Hybrid News Slider on the Front Page with the Featured Content Gallery (modified the front page template)
    • Moved the upper navigation bar below the header area (modified header.php)
    • Added lines to functions.php to make multi-level dropdowns for pages, and to handle a vanishing header utility widget as per instructions on this forum

    The other changes were to the Hybrid News CSS and image files.

    Changes made by my outsourcer recently (he upgraded to Hybrid 0.7.1, and integrated the above, plus a few other changes).

    1. Hybrid Theme Changes:
    a) In header text and tagline changed 'hybrid_site_title' function in hooks-filters.php file.
    b) also applied css for tagline and text in style.css file.
    a) did changes in functions.php to remove search box, change rss.
    d) some changes in front-page.php to look like the original customization site.
    e) To remove ''Articles in this series" (which started to appear on the home page after he upgraded, for some reason) commented two function hybrid_after_page() and hybrid_after_content() at the bottom of front-page.php.
    f) for adding rss in page-nav i add "action add_action( 'hybrid_after_page_nav', 'news_subscribe_link' );" in function.php.

    2. Hybrid Beach Theme changes:

    e) also did changes in css of page-nav and feed in style.css of hybrid beach theme.

    I hope that gives you the data needed.

    I have several blogs using this theme customization and was about to confront the task of upgrading them all to the latest Hybrid. But if there is a better way I should be going about this, I would rather sort it out now instead of later.

    Thanks a lot for your help.

  2. You must be a logged-in exclusive member to view this reply.

  3. Okay, I will post one at a time to try to keep it less confusing.

    Code in Original header.php:

    <?php hybrid_before_header(); // Before header hook ?>
    
    	<div id="header-container">
    
    		<div id="header">
    
    			<?php hybrid_header(); // Header hook ?>
    
    		</div><!-- #header -->
    
    	</div><!-- #header-container -->
    
    	<?php hybrid_after_header(); // After header hook ?>

    Modified code in new header.php (replaces the code above this):

    <div id="header-container">
    
    		<div id="header">
    
    			<?php hybrid_header(); // Header hook ?>
    
    		</div><!-- #header -->
    
    	</div><!-- #header-container -->
        <?php hybrid_before_header(); // Before header hook ?>
    	<?php hybrid_after_header(); // After header hook ?>

    That is header.php, now I will look for the others.

  4. It looks like functions.php is completely different. The following is the functions.php on the customized Hybrid:

    <?php
    
    add_filter('wp_page_menu_args', 'custom_page_nav');
    
    function custom_page_nav($args) {
    
    	$args = array(
    
    		'show_home' => __('Home','hybrid'),
    
    		'menu_class' => 'page-nav',
    
    		'depth' => 3,
    
    	);
    
    	return $args;
    
    }
    
    add_filter( 'hybrid_singular-post_entry_meta', 'my_disable_stuff' );
    function my_disable_stuff( $var ) {
    	return '';
    
    }
    
    ?>
    <?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_after_page_nav', 'news_subscribe_link' );
    
    	//add_action( 'hybrid_after_page_nav', 'hybrid_search_form' );
    
    	add_action( 'hybrid_header', 'news_get_header_widget', 11 );
    
    	add_action( 'hybrid_after_header', 'hybrid_cat_nav' );
    
    	/*
    
    	Commenting Out Subscribe Link
    
    	add_action( 'hybrid_after_cat_nav', 'news_subscribe_link' );
    
             */
    
    	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( 'wp_page_menu_args', 'news_page_menu_args' );
    
    	add_filter( 'hybrid_category_menu_args', 'news_category_menu_args' );
    
    	add_filter( 'hybrid_post_meta_boxes', 'news_post_meta_boxes' );
    
    /**
    
     * 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' );
    
    }
    
    /**
    
     * Page menu
    
     * Add/remove arguments for your page menu
    
     *
    
     * @since 0.1.1
    
     */
    
    function news_page_menu_args( $args ) {
    
    	$args['depth'] = 4;
    
    	return $args;
    
    }
    
    /**
    
     * Category menu
    
     * Add/remove arguments for your category menu
    
     *
    
     * @since 0.1
    
     */
    
    function news_category_menu_args( $args ) {
    
    	$args = array(
    
    		'depth' => 4,
    
    	);
    
    	return $args;
    
    }
    
    /**
    
     * 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' );
    
    		remove_action( 'hybrid_before_content', 'hybrid_breadcrumb' );
    
    	endif;
    
    }
    
    /**
    
     * Adds a feed/subscribe link to the category menu
    
     *
    
     * @since 0.1
    
     */
    
    function news_subscribe_link() {
    
    	echo '<div id="feed"><ul>';
    
    	echo '<li class="feed-url"><a href="' . get_bloginfo( 'rss2_url' ) . '" title="' . __('Subscribe to the feed','news') . '">' . __('Subscribe','news') . '</a></li>';
    
    	echo '</ul></div>';
    
    }
    
    /**
    
     * 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
    
     * Calls each section
    
     *
    
     * @since 0.1
    
     */
    
    function news_widget_container() {
    
    	if ( !is_page_template( 'no-widgets.php' ) ) :
    
    		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_sidebar_active( __('Tertiary', 'news') ) ) :
    
    		echo '<div id="tertiary">';
    
    		dynamic_sidebar( __('Tertiary', 'news') );
    
    		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;
    
    }
    
    ?>
  5. There are diff tools (google diff tool for your operating system) that will let you compare one file to another, so you can compare your customizations to the original files.

    Like Justin said, you can change the beach theme all you want, but the Hybrid Theme should be in its original form, so I'd just compare/diff your customized version of the parent Hybrid theme to the original files in the Hybrid theme.

  6. This is the last change to Hybrid (Everything else is in the child theme):

    File: hooks-filters.php

    Original Code:

    function hybrid_site_title() {
    	$tag = ( is_home() || is_front_page() ) ? 'h1' : 'div';
    
    	if ( $title = get_bloginfo( 'name' ) )
    		$title = '<' . $tag . ' id="site-title"><a href="' . get_bloginfo( 'url' ) . '" title="' . $title . '" rel="home"><span>' . $title . '</span></a></' . $tag . '>';
    
    	echo apply_atomic( 'site_title', $title );
    }

    Replaced by customized code:

    function hybrid_site_title() {
    	$tag = ( is_home() || is_front_page() ) ? 'h1' : 'div';
    
    	if ( $title = get_bloginfo( 'name' ) )
    		$title = '<' . $tag . ' id="site-title"><a href="' . get_bloginfo( 'url' ) . '" title="' . $title . '" rel="home"><span>' . $title . '</span></a>';
            if ( $desc = get_bloginfo( 'description' ) )
    		$title .=  '<div id="tag-line">' . $desc . '</div>';
    		$title .='</' . $tag . '>';
    	echo apply_atomic( 'site_title', $title );
    }
  7. You must be a logged-in exclusive member to view this reply.

  8. Okay. Looks like the functions.php must have been in Hybrid News so I got that mixed up.

    For header.php, do nothing when you upgrade. You moved a hook, so that needs to go back to its original state.

    For what reason this change was made is more important.

    That change to header.php was to move the page navigation menu below the header, so that it sits just above the category navigation menu.

    File: hooks-filters.php

    Do nothing here. You've taken some correct code and made it incorrect. The theme already adds the site description by default.

    With Hybrid News, the site description doesn't show up below the site title on the header. I was trying to fix this in the CSS and got stuck so months later I asked my outsourcer to do this while handling the other changes. I am not sure why he decided to change hooks-filters.php - are there separate instructions on how to get the site description (tag line) to show up?

  9. You must be a logged-in exclusive member to view this reply.

  10. Thanks for letting me know, I definitely don't want a double description or a hidden one.

    I am going to try to redo this now, using the instructions at the links you gave above.

    Thanks for your help on that.

  11. Okay I have redone almost everything -

    I started with fresh installs of the most recent versions of Hybrid and Hybrid News.

    Then I made the changes you recommended and copy-pasted some of my old customizations. But the only files that have been changed now are:

    In Hybrid News:

    Image files
    functions.php
    style.css
    front-page.css
    front-page.php

    Everything else should be exactly like Hybrid 0.7.1 and a recent download of Hybrid News.

    The only thing I did not figure out was how to put the subscribe/rss link back into the category navigation menu bar on the right. If I try to duplicate what my outsourcer had done, it gets errors. It only worked on his version.

    It is installed in this test site and you can see the subscribe link is a bit too low:

    http://websitesandwebhosting.com/greentest/

    Any suggestion?

  12. You must be a logged-in exclusive member to view this reply.

  13. Thanks, that worked!

    I just adjusted it back and forth till the subscribe fit into the category navigation without pushing the dropdowns out of alignment.

Reply

You must log in to post.

Limited Access

If you have an account, please take a moment to log in.

Non-exclusive members have limited access to the support forums.

To enjoy the full range of support, sign up for an exclusive membership in the theme club.

Support Forums

  • Core Framework (54 posts)
  • Hybrid Theme (22,711 posts)
  • Bliss Theme (255 posts)
  • Options Theme (10,362 posts)
  • Visionary Theme (767 posts)
  • WordPress (144 posts)
  • WordPress Plugins (2,146 posts)
  • bbPress Themes (308 posts)
  • General Discussion (5,572 posts)
  • Critical Theme (0 posts)
  • Hybrid News Theme (132 posts)
  • Hybrid Original Theme (26 posts)
  • Leviathan Theme (16 posts)
  • Life Collage Theme (9 posts)
  • Old School Theme (3 posts)
  • Outline Theme (108 posts)
  • Skeleton Theme (40 posts)
  • Structure Theme (2,768 posts)
  • Members Plugin (2 posts)
  • Cleaner Gallery Plugin (14 posts)
  • Get the Image Plugin (3 posts)
  • Message Board Plugin (0 posts)
  • Widgets Reloaded Plugin (0 posts)
  • Breadcrumb Trail Plugin (0 posts)
  • Query Posts Plugin (80 posts)
  • Hybrid Hook Plugin (7 posts)
  • Hybrid Hook Widgets Plugin (0 posts)
  • Hybrid Tabs (5 posts)