web-designFor a clients website I need to remove post info for multiple categories. So, here is the code I use to remove genesis_post_info from multiple categories.

[gist][/gist]

Add above code to the bottom of your child theme’s functions.php file.

So, since Genesis 1.6, and probably my favorite part of Genesis 1.6 is the theme support of genesis-structural-wraps. So now you can easily add wraps to the header, nav, subnav, inner, footer-widgets, and footer. If you’ve ever looked at the Visual Markup Guide for the Genesis Framework, you may have noticed that all of the main sections contain a div that wraps around the inner markup except the the ‘inner’ section. Have a look at this:

  • #header > .wrap
  • #nav > .wrap
  • #subnav > .wrap
  • #inner > .wrap, this is what we will be adding
  • #footer-widgets >.wrap
  • #footer > .wrap
Genesis framework

Previously to add an #inner wrap, for example, you had to:
// Add div.wrap inside of div#inner
function child_before_content_sidebar_wrap() {
echo '<div class="wrap">';
}
add_action('genesis_before_content_sidebar_wrap', 'child_before_content_sidebar_wrap');

function child_after_content_sidebar_wrap() {
echo '</div><!-- end .wrap -->';
}
add_action('genesis_after_content_sidebar_wrap', 'child_after_content_sidebar_wrap');

Genesis has made it easy for us to add the additional wrapper by using hooks. All you need to do is open up the functions.php file in your child theme and add the following code. The code should be placed at the end of the file, just before the closing ?> if there is one.
add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );

The style changes

By default the sample child theme for  genesis  is boxed in a 960px #wrap that constrains all the elements inside to that width centering them on the page. Find #wrap in your sample child theme style.css around line 162.
Change:
#wrap {
background-color: #fff;
margin: 0 auto 10px;
width: 960px;
}

to:
#wrap {
background-color: #fff;
}

This will remove the contraint and allow our elements inside to span as far as we please.

Add styles for the wrap divs that is inside each our main div structures. This style will set each area to 960px width with the margin:0 auto; centering them on the page.
.wrap {
&nbsp;&nbsp;&nbsp;&nbsp;margin: 0 auto;
&nbsp;&nbsp;&nbsp;&nbsp;width: 960px;
}

NOTE: Can be more specific to each area by adding the id of each section before .wrap for example:
#nav .wrap { width: 900px; }
Will set the nav to be shorter than the other areas.

Find each main structural div and remove its width. The width we set for .wrap will handle this. Search for #header, #nav, #subnav, #inner, #footer-widgets & #footer and remove the width set for each.

Hope this will help you to make your theme more better. 🙂

Sometimes I need to get footer outside of wrap. I tried to find out how can i do that in genesis child theme. This code I got first from Marco who got it from Daisy Olsen.

// Reposition the footer
remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
remove_action('genesis_footer', 'genesis_do_footer');
remove_action('genesis_footer', 'genesis_footer_markup_close', 15);
add_action('genesis_after', 'genesis_footer_markup_open', 5);
add_action('genesis_after', 'genesis_do_footer');
add_action('genesis_after', 'genesis_footer_markup_close', 15);

Sometimes need to change the Genesis‘s default content on demand of client to show clients requirement (i.e. footer logo, remove back to top, credential change, add footer link).

Agency-Child-Theme-Demo-built-on-the-Genesis-Framework-by-StudioPress

 NOTE: When writing your own code/filters, use a child theme. Do not write to the default functions.php file in Genesis. It will overwrite on updates.

See below for codes I wrote to change Genesis Footer Content on child themes.

Customize the footer creds text

add_filter('genesis_footer_creds_text', 'auc_footer_creds_text');
function auc_footer_creds_text($creds) {
$creds = '©' . date('Y') . ' '
. get_bloginfo('name') .
'. All rights reserved. Powered by <a href="http://wordpress.org/">WordPress</a>.';
echo $creds;
}

Remove Footer Content

This will remove the footer credits text and ‘back to top’ link.
add_filter('genesis_footer_output', 'footer_output_filter', 10, 1);
function footer_output_filter($footer_content) {
$footer_content = '';
return $footer_content;
}

Add a WordPress Custom Menu in Custom Footer.

This will remove the default footer with credit text and Back to Top and add a WordPress custom navigation menu.
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'auc_do_footer' );
function auc_do_footer() {
$creds = '© Copyright '. date('Y') . ' ' . get_bloginfo('name') . ' . All rights reserved.';
$footernav = wp_nav_menu( array('menu' => 'footer' ));
echo $footernav;
?>

If you are using Genesis Theme Framework and would like to display Google Adsense or any advertisement code after the first post on the homepage, archives, and search results page, add the code below to the child theme’s functions.php file.
add_action('genesis_after_post', 'aycchildthemes_ad_after_first_post');
function aycchildthemes_ad_after_first_post() {
global $loop_counter;
if (!is_singular() && $loop_counter == 0) { ?>
ADD YOUR GOOGLE ADSENSE CODE HERE
<?php }
}

The code above which you add should be placed anywhere after this:
require_once(TEMPLATEPATH.'/lib/init.php');
And before the following closing code (if it exists):
?>

That’s it. Let me know your experience after using this snippet. Also please share if you have tricks complete this kinda job.

This is a simple task if you use the built in is_page() conditional tag in WordPress and use one of the Genesis structural action hooks. We’ll be using the genesis_before_sidebar_widget_area action hook in this example.

<?php
// Add additional sidebar content to the book page
add_action('genesis_before_sidebar_widget_area', 'child_genesis_sidebar');
function child_genesis_sidebar() {
if ( is_page('__SPECIFIC-PAGE-ID-OR-TITLE__')) { ?>
<your-content-code>
<?php
}
}
?>

There’s a lot of small code snippets I use often. This is where I’ll collect them. If you have any quick tips, feel free to share in the comments.

Genesis-Theme-Framework-Visual-Hook-Reference

Force a page layout
This is very useful for ensuring custom pages you build for a client aren’t broken by them changing the page layout (ex: home page). Or, changing the page layout to something other than the default on archive pages (ex: category). The example below is to set the category page to Sidebar-Content-Sidebar.

// Force layout on category
add_filter('genesis_pre_get_option_site_layout', 'child_category_layout');
function child_category_layout($opt) {
if ( is_category() )
$opt = 'sidebar-content-sidebar';
return $opt;
}

Set default page layout
// Register default site layout option
genesis_set_default_layout( 'full-width-content' );

Setup the child theme
This is what I include at the top of my functions.php file in my child themes. Any time below you see an add_action or add_filter, that part goes in the setup function, and the function itself goes after the setup function.
// Start the engine
require_once(TEMPLATEPATH.'/lib/init.php');
// Setup the child theme
add_action('after_setup_theme','child_child_theme_setup');
function child_child_theme_setup() {
// ** Backend **
// Remove Purchase Themes menu link from dashboard
remove_theme_support('genesis-purchase-menu');
// ** Frontend **
}

Unregister unused page layouts
// Unregister other site layouts
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );

Add Image Sizes
This adds an image size named ‘feature’ with a fixed size of 600×250.  See Mark Jaquith’s post for details.
add_image_size('feature', 600, 250, true);

Modify Post Info

Shortcode Reference
add_filter('genesis_post_info', 'child_post_info_filter');
function child_post_info_filter($post_info) {
$post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]';
return $post_info;
}

Remove Post Info
remove_action('genesis_before_post_content', 'genesis_post_info');

Modify Post Meta
add_filter('genesis_post_meta', 'child_post_meta_filter');
function child_post_meta_filter($post_meta) {
$post_meta = '[ post_categories ] Tagged with [ post_tags ]';
return $post_meta;
}</code>
<strong>Remove Post Meta</strong>
<code>remove_action('genesis_after_post_content', 'genesis_post_meta');

Change Excerpt More text […]

function child_excerpt_more($more) {
&nbsp;   return '[.....]';
}
add_filter('excerpt_more', 'child_excerpt_more');

Remove Footer
remove_action('genesis_footer','genesis_do_footer');

Remove Footer and Footer Markup
// Remove Footer
remove_action('genesis_footer', 'genesis_do_footer');
remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
remove_action('genesis_footer', 'genesis_footer_markup_close', 15);

Customize the Search Form text
add_filter('genesis_search_button_text', 'child_custom_search_button_text');
function child_custom_search_button_text($text) {
return esc_attr('');
}

Remove Breadcrumbs
add_filter('genesis_breadcrumb_args', 'child_custom_breadcrumb_args');
function child_custom_breadcrumb_args($args) {
$args['sep'] = ' > ';
$args['labels']['prefix'] = '';
return $args;
}

Customize the Site Title (in #header)

This is useful if you want to use the default site title (Settings > Title) but style different elements of it differently. This specific code searches for “of” in the site title, and changes it to <em>of</em>.
// Customize the site title
add_filter('genesis_seo_title','child_customize_site_title', 10, 3);
function child_customize_site_title($title, $inside, $wrap) {
$custom = str_replace("of", "<em>of</em>", $title);
return $custom;
}

Customize the Site Description (in #header)
add_filter('genesis_seo_description','child_customize_site_description', 10, 3);
function child_customize_site_description($description, $inside, $wrap) {
$custom = str_replace("Redefining", "<strong>Redefining</strong>", $description);
return $custom;
}

Remove the Post Title
// Remove Post Title
remove_action('genesis_post_title','genesis_do_post_title');

Remove Page Titles
/** Remove page titles */
add_action( 'get_header', 'child_remove_page_titles' );
function child_remove_page_titles() {
if ( is_page() && ! is_page_template( 'page_blog.php' ) )
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
}

Display Description of Menu Items

To add a description to a menu item, go to Appearances > Menus. At the top right click “Screen Options”, then check “Description”. Now you can click the dropdown arrow next to menu items and add a description. The below code will make it visible on the site.
// Display Description of Menu Items
add_filter( 'walker_nav_menu_start_el', 'child_add_description', 10, 2 );
function child_add_description( $item_output, $item ) {
$description = __( $item->post_content );
return preg_replace(&nbsp; '/(<a.*?>[^<]*?)</', '$1' . '<span >' . $description . '</span></',  $item_output);
}

Register a Sidebar
genesis_register_sidebar(array(
&nbsp;   'name'=>'Homepage Widgets',
'id' => 'homepage-widgets',
'description' => 'This shows up at the bottom of the homepage.',
));

Unregister a Sidebar
unregister_sidebar('sidebar-alt');

Customize Read More Link
// Customize Read More Link
add_filter( 'excerpt_more', 'child_more_link' );
add_filter( 'get_the_content_more_link', 'child_more_link' );
add_filter( 'the_content_more_link', 'child_more_link' );
function child_more_link($more_link, $more_link_text) {
&nbsp;   return sprintf('%s', get_permalink(), 'Read More');
}