WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Apr 09 2011

Move Genesis Sidebar

There are many times due to adding various actions that I will accidentally do something (like adding an additional wrap wrongly) that will cause havoc on my sidebar where my sidebar will appear below my content. What happens is that the #sidebar is now subordinate to #content instead of them appearing together in #content-sidebar-wrap (or whatever). So I have found a simple solution for this when this happens. I move my sidebar up.

I simply add this to my functions.php file:
[php]
remove_action('genesis_sidebar','genesis_do_sidebar');
add_action('genesis_before_content', 'genesis_do_sidebar');[/php]

Yes, I recognize that this is only a bandaid, but...

Written by Travis Smith · Categorized: Genesis

Apr 08 2011

Remove Page Title from a Genesis Page with a Custom Template

Recently, I created a plethora of page templates to help with the styling of various similar pages and sub-pages, etc. However, I needed to remove to page title. So here is what I did.

In my functions.php file, I added

[php]//REMOVE PAGE TITLE
function child_remove_page_titles($page) {
if (is_page($page)) {
remove_action('genesis_post_title', 'genesis_do_post_title');
}[/php]

Then in my template, I added:

[php]add_action('get_header', 'child_remove_page_titles(115)'); //change 115 to whatever you want it to be[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Apr 07 2011

How to Create a Custom NonHierarchical Taxonomy Breadcrumb in Genesis

Recently I had the need to create a custom taxonomy breadcrumb because my custom taxonomy was non-hierarchical (like Tags). However, the launch page for this tag was lost in the Breadcrumbs, so I needed to add it back. Since my custom taxonomy was rather simple, filtering the already existent Breadcrumb class didn't make sense to me. However, I was stumped, so I reached out to Bill Erickson on Twitter (@BillErickson). He came up with this awesome, simple solution:

[php]remove_action('genesis_before_loop', 'genesis_do_breadcrumbs');
add_action('genesis_before_loop', 'tax_breadcrumbs');

function tax_breadcrumbs() {
if (is_tax()):
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
echo '<div class="breadcrumb"><a href="'.get_bloginfo('url').'">Home</a> | <a href="/page-name">Page Name</a> | '.$term->name.'</div>';
endif;

} [/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Apr 04 2011

How to Utilize AgentPress's Settings & Custom Fields in a Separate Post Type

So I wanted to separate out my blog posts from my property posts on a site. In order to do this, I needed to split posts into two post types: post and properties.

First, you need to create your custom post type (and taxonomy, if needed) in your functions.php file.
[php]function wps_custom_posttypetax() {
//Register Custom Post Type
register_post_type('wps_properties',
array(
'label' => 'Properties',
'description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'properties'),
'query_var' => true,
'register_meta_box_cb' => 'ap_add_inpost_details_box',
'menu_position' => 20,
'supports' => array('title','editor','excerpt','custom-fields','revisions','thumbnail','author'),
'taxonomies' => array('wps_designs',),
'labels' => array (
'name' => 'Properties',
'singular_name' => 'Properties',
'menu_name' => 'Properties',
'add_new' => 'Add Property',
'add_new_item' => 'Add New Property',
'edit' => 'Edit',
'edit_item' => 'Edit Property',
'new_item' => 'New Property',
'view' => 'View Property',
'view_item' => 'View Property',
'search_items' => 'Search Properties',
'not_found' => 'No Homes Found',
'not_found_in_trash' => 'No Properties Found in Trash',
'parent' => 'Parent Property',
),
)
);

//Register Custom Taxonomy
register_taxonomy('wps_designs',array (
0 => 'wps_properties',
),array( 'hierarchical' => false, 'label' => 'Designs','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'design'),'singular_label' => 'Design') );
}
add_action( 'init' , 'wps_custom_posttypetax' );[/php]

The most important line in registering my post type is:

'register_meta_box_cb' => 'ap_add_inpost_details_box',

Once this is done, go to the AgentPress > lib > admin folder and open the file inpost-settings.php. First you will want to comment out the add_action(); on line 12. So, [php]//add_action('admin_menu', 'ap_add_inpost_details_box', 9);[/php]

Find the function ap_add_inpost_details_box which should be around line 13. This function adds the meta_box to the post below the editor. Make one modification: change the post type 'post' to 'wps_properties'.
[php]function ap_add_inpost_details_box() {
add_meta_box('ap_inpost_details_box_1', __('Property Details - Section #1', 'genesis'), 'ap_inpost_details_box_1', 'wps_properties', 'normal', 'high');
if( genesis_get_option('features_2_col1_1', AP_SETTINGS_FIELD) ) {
add_meta_box('ap_inpost_details_box_2', __('Property Details - Section #2', 'genesis'), 'ap_inpost_details_box_2', 'wps_properties', 'normal', 'high');
}
}[/php]

Now you should be ready to use the AgentPress Settings with an another post type; however, it may or may not be used with the PAGE post type as there is one other change that would need to be made in function ap_inpost_details_save. While I haven't tested this, this line:
[php]if(('page' == $_POST['post_type'] && !current_user_can('edit_page', $post_id)) || !current_user_can('edit_post', $post_id ))
return $post_id;[/php]
would need to be changed to:
[php]if((!current_user_can('edit_page', $post_id)) || !current_user_can('edit_post', $post_id ))
return $post_id;[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Apr 01 2011

How to Determine What Site Layout Is Being Used in a Genesis Child Theme

To determine what site layout is being used dynamically use this simple statement.

[php]$site_layout = genesis_site_layout();[/php]

Written by Travis Smith · Categorized: WordPress

  • « Previous Page
  • 1
  • …
  • 45
  • 46
  • 47
  • 48
  • 49
  • …
  • 61
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in