WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Apr 22 2011

How to Add Formatting Tags to Genesis's Content Limit in Content Archives

Recently, I started limiting my content by using Display Post Content under Genesis > Theme Settings > Content Archives instead of using Display Post Excerpt. While the default is Display Post Content, the next field Limit content to ## characters is usually blank. However, I wanted to limit the content archives while maintaining my formacodeing.

So, upon limiting my content, I discovered that this actually strips all the tags except <code><script></code> and <code><style></code>. However, I wanted to allow basic formacodeing tags like <code><b></code>, <code><em></code>, and <code><br></code>. Gratefully, Genesis has a filter that will allow you to keep these tags in the content limit. To add the tags, you will need to add a filter in your functions.php.

[php]
add_filter('get_the_content_limit_allowedtags', 'get_the_content_limit_custom_allowedtags');
function get_the_content_limit_custom_allowedtags() {
return '<script>,<style>,<b>,<br>,<em>'; //add whatever tags you want to this string
}
[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

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

Mar 31 2011

How to Make a Private eCommerce Store Using Shopp

So one person asked if I could make Shopp available for users who have a registered customer login that they control. So the first thing you have to do is setup Shopp on the backend by allowing Customer Accounts via Shopp > Settings > Checkout. I always select Enable Account Logins integrated with WordPress Accounts just in case the person wants to move towards some sort of Client Portal as well.

Then in Shopp > Settings > Presentation, I used Enable theme templates, which enables me to edit some files without having to worry about hacking core (never hack core!) to customize the way I want it. So then I open my catalog.php template file. As you can see the catalog.php template consists of only one line.

[php]<?php shopp('catalog','catalog-products'); ?>[/php]

Then I open login.php template file, which contains the login information I need for a private ecommerce store for my customers, or my invite-only elite customers. I copy the entire file and paste it with my catalog.php. Then I add one line ahead of the login.php file:
[php]if( ! shopp('customer','loggedin')) {
//login.php login form code
}
else
shopp('catalog','catalog-products');
[/php]

Don't forget that you may also want to hide/unregister your sidebars, or if you are using a genesis theme you can force a content only layout.

So now my store page which calls the shortcode [ catalog ] will now refer to my edited template forcing customers to login before they can see anything. Since I have my customers connected to WordPress accounts, I could also refer customers to the WordPress login screen. Since my store was a bit more complicated as I used a secondary menu system (full of custom links referring to Shopp Categories), connecting customers to WordPress accounts made making the menu system workable. For the front page, I created a fake WordPress custom menu and upon login, the menu system was replaced with a live custom menu, which I talk about here.

Written by Travis Smith · Categorized: Plugins, Tutorials

  • « Previous Page
  • 1
  • …
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • 18
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

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