Community Forums › Forums › Archived Forums › General Discussion › Understanding Genesis Functions (Help)
- This topic has 7 replies, 2 voices, and was last updated 10 years, 5 months ago by nutsandbolts.
-
AuthorPosts
-
November 8, 2013 at 7:37 am #71659Joseph LeeMember
So it's easy to find the hooks. I still don't know how to find the functions. If I want to remove an H1 from a template file, how do I do that?
I know genesis_before_header executes before the header. So if I want to remove the entire header div, for example, how do I know how to do that? What is the function called that prints out the header? Sometimes I see snippets that remove do_something from genesis, but I don't know where the author of the snippet found that the function existed.
November 8, 2013 at 12:32 pm #71726nutsandboltsMemberFor your example of removing the header div, are you wanting to remove the entire header from the whole site? It may be easier to do that with CSS - you can do
#header { display: none; }
on XHTML themes or#site-header { display: none; }
on newer HTML5 themes.Many of the functions are contained in the Genesis framework files - those files should never ever be edited, but you can use your child theme's functions.php to remove the things that are called in the framework. Hopefully that makes sense.
Most of the time, you can save the time of searching through the framework and just search online for the function you need, but I understand that may not always be possible if you're wanting to do something that isn't commonly done.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 8, 2013 at 1:15 pm #71739Joseph LeeMemberI wanted to remove the header in php, not in css. Css still causes it to be loaded then hidden. I don't like imagining that everytime I want to remove something on genesis I have to display none it. It's tasking to client browsers. Not that it's a huge task, it's just not right. I could achieve this on server side, if genesis documented the actions better.
I see all of the hooks. I just don't see the actions documented. So it's not easy to know what to remove.
November 8, 2013 at 1:17 pm #71741nutsandboltsMemberI'm not saying you have to use CSS; I was just suggesting that as something that might be easier to implement depending on whether you wanted to remove it sitewide or just on certain pages/posts. To be honest, I've never seen anyone remove the entire site header, so I thought I misunderstood.
To remove the header with a function, just add the following to functions.php:
// Remove Header remove_action( 'genesis_header', 'genesis_do_header' );
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 8, 2013 at 1:20 pm #71746Joseph LeeMemberWhere did you find genesis_do_header.
Can genesis remove any div with a function? I don't understand how the framework assembles the page. I add actions to hooks easily enough. Though I don't know where the documentation is for all of the functions that print out the structure of the page.
Thanks for helping thus far NutsandBolts.
November 8, 2013 at 1:22 pm #71747nutsandboltsMemberIn the Genesis framework files, here is header.php:
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ do_action( 'genesis_doctype' ); do_action( 'genesis_title' ); do_action( 'genesis_meta' ); wp_head(); //* we need this for plugins ?> </head> <?php genesis_markup( array( 'html5' => '<body %s>', 'xhtml' => sprintf( '<body class="%s">', implode( ' ', get_body_class() ) ), 'context' => 'body', ) ); do_action( 'genesis_before' ); genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="wrap">', 'context' => 'site-container', ) ); do_action( 'genesis_before_header' ); do_action( 'genesis_header' ); do_action( 'genesis_after_header' ); genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="inner">', 'context' => 'site-inner', ) ); genesis_structural_wrap( 'site-inner' );
So that shows you every action acting on the header, and you can modify or remove them in your functions.php depending on what you need the site to do.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+November 8, 2013 at 1:30 pm #71752Joseph LeeMemberI see. So if that is the header.php where would I find the function do_action('genesis_header');
I am trying to use either genesis or woothemes. Woothemes is more traditional. You just copy the markup from page.php and make adjustments. Genesis requires a lot of knowledge of genesis, that they don't really bother to document/tutorial.
I like your site btw.
November 8, 2013 at 1:35 pm #71754nutsandboltsMemberThat function is toward the end of header.php -
do_action( 'genesis_before_header' ); do_action( 'genesis_header' ); do_action( 'genesis_after_header' );
So if you want to remove the header, you just remove the action via functions.php to counteract what's in header.php.
Most of the time, it's easier to just google things like "genesis how to remove header" and benefit from the knowledge of others in the community - no need to reinvent the wheel.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+ -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.