WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 24 2011

How to Switch Primary Sidebar to Secondary Sidebar for a Specific Page in Genesis

For one of my sites, the person wanted to use two different sidebars: one for his store and another for his blog. The rest of the site was full-width layout. So we used the two sidebars: Primary (sidebar) and Secondary (sidebar-alt). So here's how to switch sidebars (without using Nathan's phenomenal plugin Simple Sidebars) using functions.php.

[php]//switch sidebars
add_action('get_header','change_genesis_sidebar');
function change_genesis_sidebar() {
$pages = array(181);

if ( is_page($pages)) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
}
} [/php]

This code can be easily adapted to be done based on category, archives, author, etc. See the conditional tags for more details.

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 23 2011

How to Customize Genesis's Search Form Text and Button Text

Customize the Search Form text
[php]add_filter('genesis_search_text', 'be_custom_search_text');
function be_custom_search_text($text) {
return esc_attr('Search');
}[/php]

Customize the Search Button text
[php]add_filter('genesis_search_button_text', 'be_custom_search_button_text');
function be_custom_search_button_text($text) {
return esc_attr('');
}[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 21 2011

How to Create a WordPress Custom Post Type Template in Genesis

Custom post types can be rather confusing, daunting, intimidating, and frankly difficult. However, with Genesis, custom post types are easy as registering your post type, creating a template, and adding a page that uses the template. While I will assume that you know how to register your custom post type, if you don't download Brad William's/WebDevStudios' Custom Post Type UI Plugin.

To create your page template, you can simply download it here ([download id="5"]), or follow these instructions. In your favorite text editor, create a new document. Then add the following code:
[php]<?php
/*
*Template Name: Custom Post Type Template
*/

remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_do_loop');
function custom_do_loop() {
global $paged;
$args = array('post_type' => 'my_post_type');
//$args = array('post_type' => 'books');

genesis_custom_loop( $args );
}
genesis();
?>[/php]
Template Name: Custom Post Type Template identifies it as a page template, so when you click Pages > Add New, your new template will appear in the right hand side for Page Templates as whatever you named it. To customize this template, change my_post_type to whatever you named your post type, which should be all lower case with no spaces. The default is 'post', which does not pick up your custom post type.

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 21 2011

How to Ensure that Your Lightbox Is Not Behind Your Flash/YouTube Video

On one of the websites that I was building, I had Next-Gen Galleries and YouTube videos on the same page. In one instance, I would click on the image for the thickbox to appear and the YouTube video sat on top. The YouTube video was embedded as an iframe.

[html]<iframe height="360" frameborder="0" width="580" src="http://www.youtube.com/embed/odXK8yMCuwM?color1=234900&amp;color2=4e9e00&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1" title="YouTube video player"></iframe>[/html]

So in order to add the wmode property to the video, I added &amp;wmode=Opaque to the end of the URL, so:

[html]<iframe height="360" frameborder="0" width="580" src="http://www.youtube.com/embed/odXK8yMCuwM?color1=234900&amp;color2=4e9e00&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1&amp;wmode=Opaque" title="YouTube video player"></iframe>[/html]

Then I was able to view my lightbox/thickbox with no issues.

Written by Travis Smith · Categorized: Tutorials

Mar 21 2011

How to Edit Author, Date, Time, Comments Link, Tags and Categories (Post Information) in Genesis

To Edit Author and Date Post Information, simply add the following to your functions.php file. This code uses Genesis specific shortcodes.

[php]// Modify Post Info
add_filter('genesis_post_info', 'my_post_info_filter');
function my_post_info_filter($post_info) {
if (!is_page()) {
$post_info = '[ post_date] by [ post_author_posts_link] at [ post_time] [ post_comments] [ post_edit]'; //remove spaces after initial [
//$post_info = 'Custom text'; //edit this to whatever you'd like.
}
return $post_info;
}[/php]

Available shortcodes are (without the space in front):

  • [ post_date]: Date of publication; e.g., [ post_date format="F j, Y" label="Dated: "] = Dated: March 21, 2011
  • [ post_time]: Time of publication; e.g., [ post_time format="g:i a"] = 1:29 am
  • [ post_author]: Displays author's name; e.g., [ post_author before="<em>" after="</em>"] = <em>Travis Smith</em>
  • [ post_author_link]: Produces the link to Author URL; e.g., [ post_author_link before="" after=""] = Travis Smith
  • [ post_author_posts_link]: Produces the link to Author's Archive; e.g., [ post_author_link before="" after=""] = Travis Smith
  • [ post_comments]: Produces the Comment Link; e.g., [ post_comments zero="No Comments" one="1 Comment" more="% Comments"] =
    • No Comments
    • 1 Comment
    • # Comments
  • [ post_tags]: Displays the tag link list; e.g., [ post_tags sep=", " before="Tags: "] =
  • [ post_categories]: Displays the category link list; e.g., [ post_categories sep=", " before="Posted Under: "] = Posted Under: Genesis, Tutorials
  • [ post_edit]: Displays the Edit link for logged in users; e.g., [ post_edit before="(" after=")"] =

For more shortcodes, see StudioPress's Shortcodes.

Written by Travis Smith · Categorized: Genesis, Tutorials

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

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