Beginners Guide To The genesis(); Function

If you open the genesis folder, you’ll find several files contain a genesis(); tag at the end of the file.

These files, which are located in the root directory of the genesis folder, all contain the genesis(); tag.

  • 404.php
  • index.php
  • page.php
  • page_archive.php
  • page_blog.php
  • search.php
  • single.php

You’ll also find most child themes built on Genesis, also contain the genesis(); tag in templates files like the:

  • front-page.php
  • home.php
  • page_landing.php
  • archive-portfolio.php
  • single-portfolio.php

If you go to genesis/lib/framework.php and open the framework.php file, you’ll find all the code which makes up the genesis(); function.

Basically the genesis(); function contains 3 key components:

  1. 2 WordPress functions
  2. HTML 5 & XHTML markup
  3. 7 action hooks

1. WordPress Functions

2 WordPress functions get_header(); and get_footer(); which include both the header.php and footer.php template files.

You can view both these template files in the genesis/lib/structure folder.

2. Markup

The markup for the main content area and content sidebar wrap classes.

Includes both HTML 5 selector classes for the new Pro themes and XHTML I.D classes for older themes.

3. Action Hooks

7 action hooks you can use to add content before and after the loop.

do_action( 'genesis_before_content_sidebar_wrap' );
do_action( 'genesis_before_content' );
do_action( 'genesis_before_loop' );
do_action( 'genesis_loop' );
do_action( 'genesis_after_loop' );
do_action( 'genesis_after_content' );
do_action( 'genesis_after_content_sidebar_wrap' );

One of these hooks is the genesis loop: do_action( 'genesis_loop' );.

Attached to the genesis_loop hook are several custom loops you can view in the genesis/lib/structure/loops.php file.

The custom loops generally pull in the title, content, genesis hooks and everything else included in a modified WordPress loop.

This post is written in response to this forum question:

Where can I find this function written out?

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.