Getting started with 3.0

Hybrid Core (framework) 15 posts 4 voices

  1. Hi Justin,

    Hopefully this isn’t too early to start asking about 3.0 but I’m giving it a try on a new project I’m starting, and running into some initial issues:

    Stylesheets
    In 2.x I called the main stylesheet this way, which isn’t working in 3.0:

    add_theme_support( 'hybrid-core-styles', array( 'style' ) );

    Theme Layouts

    I’ve added theme layout support as you’ve detailed here: https://github.com/justintadlock/hybrid-core/issues/103

    The layout metabox appears on a page, but doesn’t contain the layout options.

    I’m wondering if I’ve called the framework incorrectly…

    require_once( $cinchws_dir . 'library/hybrid.php' );
    new Hybrid();
  2. Styles

    This feature has actually been removed. Doing styles that way hasn’t felt right to me since I first added that feature. I want theme devs to use core methods when possible. So, what HC does now is simply register 4 styles that you may or may not use. The following are the handles:

    * hybrid-one-five
    * hybrid-gallery
    * hybrid-parent (parent theme)
    * hybrid-style (child or active theme)

    Since they’re registered, you’d just need to enqueue them like any ol’ style. Here’s an example:

    add_action( 'wp_enqueue_scripts', 'my_load_styles' );
    
    function my_load_styles() {
    
    	if ( is_child_theme() )
    		wp_enqueue_style( 'hybrid-parent' );
    
    	wp_enqueue_style( 'hybrid-style' );
    }

    Layouts

    Can you post your full code for layouts? The new layouts system is still under development, but it should work.

    Also, note some of the code changed. Check this comment: https://github.com/justintadlock/hybrid-core/issues/103#issuecomment-101084600

  3. Thanks for the clarification on the styles. Makes sense.

    Here’s my code for the theme layouts:

    function cinchws_theme_setup() {
    //...
    // Layout Support
    	add_theme_support( 'theme-layouts', array( 'default' => '1c' ) );
    	add_action( 'hybrid_register_layouts', 'cinchws_register_layouts' );
    
    // ...
    }
    
    /**
     * Registers custom theme layouts
     *
     * @since  1.0.0
     */
    
    function cinchws_register_layouts() {
    
        hybrid_register_layout(
            '1c',
            array(
                'label'            => _x( '1 Column', 'theme layout', 'cinchws' ),
                'is_global_layout' => true,
                'is_post_layout'   => true,
                'image'            => '', // Image URL. Doesn't do anything yet.
            )
        );
    
        hybrid_register_layout(
            '2c-r',
            array(
                'label'            => _x( '2 Columns: Sidebar / Content', 'theme layout', 'cinchws' ),
                'is_global_layout' => true,
                'is_post_layout'   => true,
                'image'            => '', // Image URL. Doesn't do anything yet.
            )
        );
    
        hybrid_register_layout(
            '2c-w',
            array(
                'label'            => _x( '2 Columns Wide', 'theme layout', 'cinchws' ),
                'is_global_layout' => true,
                'is_post_layout'   => true,
                'image'            => '', // Image URL. Doesn't do anything yet.
            )
        );
    }
  4. Here’s the registration code I’ve been testing with too:

    add_action( 'hybrid_register_layouts', 'saga_register_layouts' );
    
    function saga_register_layouts() {
    
    	hybrid_get_layout( 'default' )->image = '%s/images/layouts/default.png';
    
    	hybrid_register_layout( '1c',        array( 'label' => __( '1 Column Wide',                'saga' ), 'image' => '%s/images/layouts/1c.png' ) );
    	hybrid_register_layout( '1c-narrow', array( 'label' => __( '1 Column Narrow',              'saga' ), 'image' => '%s/images/layouts/1c-narrow.png' ) );
    	hybrid_register_layout( '2c-l',      array( 'label' => __( '2 Columns: Content / Sidebar', 'saga' ), 'image' => '%s/images/layouts/2c-l.png' ) );
    	hybrid_register_layout( '2c-r',      array( 'label' => __( '2 Columns: Sidebar / Content', 'saga' ), 'image' => '%s/images/layouts/2c-r.png' ) );
    }
  5. Sorry to bump an old thread. Are there currently any themes that use HC3? I come from Thesis and then Genesis background and have managed to pass a theme to WP.org way back. But I need something to get started.

    I started building on top of Hybrid Base, but it doesn’t like HC3 I think.

  6. 1.0.0 should be changed to whatever version you want. It’s at 1.0.0 because it’s a starter theme. HB assumes that you will be building a custom theme from scratch.

  7. @Justin- A thought about the HB version number. I think it would be helpful to have some kind of designation in the version number to reflect it is now for HC3, just to avoid any confusion. Perhaps: v1.0.0-HC3 ? Just a thought. And thanks for the quick updating of HB. –Bill

  8. Yeah, I’ve been thinking about how to tag the releases if I decide to have releases at all. Using the HC version makes sense in some ways.