In previous parts of the Genesis Explained series I talked about actions and filters, but Genesis is so much more than that. One of the great things about Genesis is all the helper functions. Today I am going to very quickly review them then I dig into detail for each individual function.
First, lets look at the files. Just like everything else, the folders and file names will help us quickly find what we are after, so check out the genesis/lib/functions/ folder.
- admin.php: ( two functions that create checkbox output )
- depreciated.php (functions that shouldn’t be used any longer since they have been replaced by new functions)
- feed.php (an action and filter with their functions to redirect the feed)
- formatting.php (functions to format text or returned values of other functions)
- general.php ( for functions that don’t fit in well with others. Often these will build until a logical group can be formed and a new file is added)
- hooks.php (assigned hooks to a function, look here for a list of hooks)
- i18n.php (theme translation file)
- image.php (functions for retrieving the thumbnails)
- layout.php (functions to change the layout/layout options of the site
- menu.php (the genesis_nav() function)
- options.php (functions for retrieving options and custom fields)
- seo.php (functions related to theme SEO)
- upgrade.php (handles the theme upgrade)
- widgetize.php (handles creation of default sidebars, footer sidebars, and provides the genesis_register_sidebar() helper function)
OK, so now you have some idea of what is in the files. Take time to read through them. We will be discussing most of the files and functions within in the upcoming articles of the series, but I want to get you started with some of the most often used functions. Again, the full details will come later, but for now check this out
This function and genesis_image() work to retrieve the featured image. Actually it does so much more. It will also pull the first attached image if you forget to set a featured image. There are several arguments that can be passed, which will will discuss in detail later. The difference in genesis_get_image() and genesis_image() is that genesis_image() will echo the value returned by genesis_get_image(). This means you don’t have to type out “echo” when working with the function. There are plenty of neat tricks you can do as a result of how this works.
Like genesis_get_image() there is a genesis_custom_field() function that echos the genesis_get_custom_field() value. This uses the $post->ID automatically and only requires the field key.
Another handy function that can be used as the_content_limit() to directly echo the value. This function uses get_the_content() to retrieve the content and then limit it. This is similar to the_excerpt() but with several advanced featured like easily adjusting the length, more accuracy (character count v word count), and built in read more link.
I know this is just whetting your appetite, but don’t worry, soon and very soon I’ll be digging into these key functions, all the arguments they take, and any filters you can access to adjust the output.
In the mean time, be sure to subscribe to the feed or signup for the feed to be delivered to your email by putting your email in the sidebar widget. Don’t forget to put together your ideas for the Child Theme Creation Wish List.