• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

yogidev

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • May 1, 2015 at 4:12 am in reply to: Why do you need to add // Start the engine php code #149703
    yogidev
    Member

    Hi, I just found this post.

    I am fairly new to php, and been searching around for a solution to why my functions stop working when I add the lib/init.php at the top.

    For example, this code stops working:

    // Remove page titles
    //* Remove page title for a specific page (requires HTML5 theme support)
    //* Change '28' to your page id
    add_action( 'get_header', 'child_remove_page_titles' );
    function child_remove_page_titles() {
    if ( is_page( ) ) {
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
    } 

    I tried including it within this block but still not working..

    // Start the engine the other way
    
    add_action( 'genesis_setup','genesischild_theme_setup', 15 );
    function genesischild_theme_setup() {
    
    //Add support for HTML5 markup
    add_theme_support( 'html5' );
    //Add viewport metatag
    add_theme_support( 'genesis-responsive-viewport' );
    //Add 3 footer widgets
    add_theme_support( 'genesis-footer-widgets', 4 );
    //Add support for custom background
    add_theme_support( 'custom-background' );
    
    }

    Any help much appreciated!

    May 1, 2015 at 3:52 am in reply to: lib/init.php needed?? #149701
    yogidev
    Member

    I would really like to know this as well.
    One of the reasons I went with Genesis is that I heard the support community was so strong!
    This seems like a pretty fundamental thing that should be documented somewhere?

    What I am actually trying to achieve (that apparently requires adding the lib/init.php line) is implementing sidebars for a blog section within a child theme that does not use sidebars elsewhere.

    Any pointers?

    May 1, 2015 at 3:46 am in reply to: Trouble registering sidebar #149700
    yogidev
    Member

    I had to put this on hold for a while working on other projects.

    Could you explain why the functions dont work after adding lib/init.php at the top?

    March 13, 2015 at 12:32 pm in reply to: Trouble registering sidebar #144312
    yogidev
    Member

    Ok so I added that and now the page loads but without my custom functions.

    For example.

    // Remove page titles
    //* Remove page title for a specific page (requires HTML5 theme support)
    //* Change '28' to your page id
    add_action( 'get_header', 'child_remove_page_titles' );
    function child_remove_page_titles() {
    if ( is_page( ) ) {
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
    } 

    I am now getting page title and my defined h1s output on the page.
    Lots of other custom stuff in functions.php is not working.

    The sidebars still dont appear either!

    March 12, 2015 at 10:06 am in reply to: Trouble registering sidebar #144197
    yogidev
    Member

    Definitely Genesis yes,

    I'm using this:

    // Start the engine the other way
    
    add_action( 'genesis_setup','genesischild_theme_setup', 15 );
    function genesischild_theme_setup() {
    
    //Add support for HTML5 markup
    add_theme_support( 'html5' );
    //Add viewport metatag
    add_theme_support( 'genesis-responsive-viewport' );
    //Add 3 footer widgets
    add_theme_support( 'genesis-footer-widgets', 4 );
    //Add support for custom background
    add_theme_support( 'custom-background' );
    }
    March 12, 2015 at 8:11 am in reply to: Trouble registering sidebar #144161
    yogidev
    Member

    Thanks Kelly.

    I pasted:

    /** Register widget areas */
    genesis_register_sidebar( array(
    'id'	=> 'cta-1',
    'name'	=> __( 'Call to Action #1', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-2',
    'name'	=> __( 'Call to Action #2', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-3',
    'name'	=> __( 'Call to Action #3', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-4',
    'name'	=> __( 'Call to Action #4', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) ); 

    followed by:

    /**
    * Add CTA widget support for site. If widget not active, don't display
    *
    */
    function mp_cta_genesis() {
    // Don't display the CTA on the home page, since it's built into the MP theme
    if ( is_home() ) {
    return;
    }
    // If it's the About page, display CTA #1
    elseif ( is_page( 'about' ) ) {
    genesis_widget_area( 'cta-1', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If it's a page with ID 101 or 102 or any page within my Portfolio CPT
    // Display CTA #2
    elseif ( is_page( array(101,102) ) || ('portfolio' == get_post_type() ) ) {
    genesis_widget_area( 'cta-2', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If it's the Contact page, display CTA #3
    elseif ( is_page('contact') ) {
    genesis_widget_area( 'cta-3', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If all else fails and none of the above conditions are met, display CTA #4
    else {
    genesis_widget_area( 'cta-4', array(
    'before' => '<div id="cta"><div id="enews" class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    } 

    in functions.php

    I get Fatal error: Call to undefined function genesis_register_sidebar()

    This code:
    http://carlomanf.id.au/run-unique-sidebars/

    didnt generate any errors but it didnt output a sidebar either (after I added some widgets to the new items).

    The page source didnt show any sidebar references anywhere either.

    What am I missing?

    February 27, 2015 at 1:53 pm in reply to: Hardcode nav #142566
    yogidev
    Member

    Ah I hadn't realised the description is a hidden option in admin menu area.

    I managed to find this code which is working:

    // Menu with Description
    
    class Menu_With_Description extends Walker_Nav_Menu {
        function start_el(&$output, $item, $depth, $args) {
            global $wp_query;
    
            $indent = ( $depth ) ? str_repeat( " ", $depth ) : '';
    
            $class_names = $value = '';
    
            $classes = empty( $item->classes ) ? array() : (array) $item->classes;
    
            $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
            $class_names = ' class="' . esc_attr( $class_names ) . '"';
    
            $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
    
            $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
            $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
            $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
            $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
    
    		// get user defined attributes for thumbnail images
    		$attr_defaults = array( 'class' => 'nav_thumb' , 'alt' => esc_attr( $item->attr_title ) , 'title' => esc_attr( $item->attr_title ) );
    		$attr = isset( $args->thumbnail_attr ) ? $args->thumbnail_attr : '';
    		$attr = wp_parse_args( $attr , $attr_defaults );
    
            $item_output = $args->before;
    
    		// thumbnail image output
    		$item_output .= ( isset( $args->thumbnail_link ) && $args->thumbnail_link ) ? '<a' . $attributes . '>' : '';
    		$item_output .= apply_filters( 'menu_item_thumbnail' , ( isset( $args->thumbnail ) && $args->thumbnail ) ? get_the_post_thumbnail( $item->object_id , ( isset( $args->thumbnail_size ) ) ? $args->thumbnail_size : 'thumbnail' , $attr ) : '' , $item , $args , $depth );		
    		$item_output .= ( isset( $args->thumbnail_link ) && $args->thumbnail_link ) ? '</a>' : '';
    
    		// menu link output
            $item_output .= '<a'. $attributes .'>';
            $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    
    		// menu description output based on depth
            $item_output .= ( $args->desc_depth >= $depth ) ? '<br /><span class="sub">' . $item->description . '</span>' : '';
    
    		// close menu link anchor
            $item_output .= '</a>';
            $item_output .= $args->after;
    
            $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
        }
    }
    
    add_filter( 'wp_nav_menu_args' , 'my_add_menu_descriptions' );
    function my_add_menu_descriptions( $args ) {
    	$args['walker'] = new Menu_With_Description;
    	$args['desc_depth'] = 0;
    	$args['thumbnail'] = true;
    	$args['thumbnail_link'] = false;
    	$args['thumbnail_size'] = 'nav_thumb';
    	$args['thumbnail_attr'] = array( 'class' => 'nav_thumb my_thumb' , 'alt' => 'test' , 'title' => 'test' );
    
    	return $args;
    }
    
    February 27, 2015 at 1:15 pm in reply to: Hardcode nav #142558
    yogidev
    Member

    Hi, thanks for the reply.

    I looked up walker classes and I don't see how that could work.

    Here is the site in development:

    http://sulekhruparell.yanwhite.com/about/

    Each item needs to have this kind of content:

    <li><a>
    <em>About</em>
    <span>A bit about me</span>
    </a></li>

    Is there a way to do that? It seems an extra field would need to appear in the admin menu area, which is why I just hardcoded it.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble