Getting started with 3.0

Hybrid Core (framework) 7 posts 2 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' ) );
    }