WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Apr 29 2011

How to Write a Genesis Custom Loop for Specific Categories in a Genesis Page Template

So I was creating page templates that called for a custom loop for specific categories that I blocked from my blog in my Genesis Settings. To do this, use this page template.

You do not need to use 'cat' which requires the category ID; however, it is always my preference. You can also choose from wp_query:

  • cat (int) - use category id.
  • category_name (string) - use category slug (NOT name).
  • category__and (array) - use category id.
  • category__in (array) - use category id.
  • category__not_in (array) - use category id.

[php]
<?php
/**
*
* Template Name: Projects
* This file handles blog posts with the category Projects within a page.
*
*/

remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_do_cat_loop');

function custom_do_cat_loop() {
global $query_args; // any wp_query() args
$args= array('cat' => '30');
genesis_custom_loop(wp_parse_args($query_args, $args));
}

genesis();

[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Apr 26 2011

Genesis Navigation Shortcode: Insert the Nav or Menu Bar into Facebook Tabs Post

Now, creating Facebook tabs using Facebook Tab Manager (see previous post), only allowed me to create "pages." However, I wanted a menu system for my Facebook tabs to be controlled within my WordPress site, so instead of creating a template for Facebook Tab Manager that included a navigation system that connected all my Facebook Tabs, I created a navigation shortcode for users to insert their desired navigation menu, created in WordPress's custom menus and have further control. Since Facebook Tabs Posts are their own custom post type, creating a menu system for them is quite easy.

How the Genesis Nav Shortcode Works

To use the code, insert [genesis_nav] into your post. It takes a few different arguments:

  • container_class: adds a custom class to the wrap class
  • menu: the menu that is desired; accepts (matching in order) id, slug, name
  • custom_class: adds a custom class to the menu system, pulls superfish option from Genesis theme settings

The default output code is:
[php]
<div id="nav"><div class="wrap">WP_NAV_MENU</div></div>
[/php]

Sample:
[genesis_nav menu=39 custom_class='fun']

Code/Download

You can download the code [download id="7"], insert into your child theme folder, and include the following in your functions.php file.
[php]require_once(STYLESHEETPATH.'/genesis_nav_shortcode.php');[/php]

Or, here's the entire code that can be added to functions.php.
[php]
<?php
//nav shortcode
add_shortcode('genesis_nav', 'genesis_nav_shortcode');
function genesis_nav_shortcode( $atts ) {
$menu_setting = genesis_get_option('nav_superfish') ? 'nav superfish' : 'nav';
$defaults = array(
'container' => '',
'container_class' => '',
'menu' => '',
'menu_class'=> $menu_setting,
'custom_class'=>'',
'echo'=>0
);

$atts = shortcode_atts( $defaults, $atts );
$classes = $menu_setting;
$classes .= ' '. $atts['custom_class'];
$nav = wp_nav_menu(array(
'container' => $atts['container'],
'menu' => $atts['menu'],
'menu_class' => $classes,
'echo' => $atts['echo']
));

echo '<div id="nav"><div class="wrap'.$atts['container_class'].'">' . $nav . '</div></div>';
}
?>
[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

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 20 2011

Two Helps to Genesis Theme/Website Development

Any time I am creating a website using the Genesis Framework, I always have at least one additional website open: Chris's Genesis Visual Hook Guide. This has proven priceless for me as I create websites and troubleshoot mine as well as others. Since many of us are visually inclined, this makes the many hooks, filters, & markup visible in a semi-static way.

Another tool that has recently appeared is Rafal Tomal's Genesis Hooks Tool. Rafal has the user drop the file in the Child Theme folder and call it via functions.php, and the file shows where all the hooks are in your Child Theme. Sometimes Child Theme home pages don't contain all the hooks and this can be quite frustrating when trying to place something on the home page via hooks. However, Rafal's tool easily identifies the hooks that are in play and displays them on the screen!

Check out both of these helps. Please let me know if you know of any other helps for Genesis Development!

Written by Travis Smith · Categorized: Genesis

Apr 11 2011

"Simple" Plugins Developed Specifically for Genesis by the StudioPress/Genesis Community

Besides the Genesis plugins that are listed by StudioPress, there are some excellent Genesis plugins in the larger community.

Widgets
First and foremost is the one created by Nick_theGeek: Genesis Featured Widget Amplified. Simply I believe Nick's widget does an excellent job. The other Genesis widgets are: Genesis Featured Grid by Heavy Digital and Enhanced Latest Tweets by Travis and Nick, which needs updating. However, we also fail to mention the Child Theme custom widgets that have not been developed into plugins.

Theme Settings
There are three plugins that add to the Theme Settings Page:

  1. WPChildThemes's Genesis Layout Manager, which allows you to set the theme's layout based on the simple conditionals (Home Page, 404 Page, Search Page, Date Archive Page, Author Page, Category Page, Tag Page, Taxonomy Page, "Post" Page, "Page" Page).
  2. Nick_theGeek's Genesis Style Select, which allows you to easily change CSS files in the Child Theme (and will probably phased into Genesis core).
  3. Cochran's Genesis Post Teasers, auto generates post teasers for Genesis blog style homepage.
  4. While this one doesn't add to the Theme Settings Page, it appears at the same level under the Genesis heading. Cochran's Genesis Favicon Uploader adds a theme option page to genesis to allow the user to upload a favicon without ftping into the themes folders.

Genesis Simple Plugins
In keeping with the Genesis Simple Sidebars, Ron Rennick created Simple Menus, which allows you to assign WordPress navigation menus to the secondary navigation menu within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis.

And though only connected by name, Genesis Simple Headers by John Hawkins allows you to easily upload a header image (however, I haven't been able to get this to work on any of my installs).

And Genesis - Comment Title allows you to change the default title on the comments area on WordPress posts and pages through a dashboard widget, that I couldn't find.

WordPress Admin Bar
Two plugins essentially do the same thing: Remkus de Vries's Genesis Admin Bar Addition and Gary Jones's Genesis Admin Bar Plus. Gary admits that his plugin is a rewrite of DeFries "as a class to remove function pollution from the global scope." If you like the Admin Bar and are a Genesis Developer/User, then you'll love Gary's plugin.

Written by Travis Smith · Categorized: Genesis

  • « Previous Page
  • 1
  • …
  • 11
  • 12
  • 13
  • 14
  • 15
  • …
  • 20
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

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