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

WordPress Facebook 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 Facebook Nav Shortcode Works

To use the code, insert [fb_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: already includes the nav class, adds a custom class to the menu system

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

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

Code

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

Or, here's the entire code that can be added to functions.php.
[php]
<?php
//nav shortcode
add_shortcode('fb_nav', 'fb_nav_shortcode');
function fb_nav_shortcode( $atts ) {
$defaults = array(
'container' => '',
'container_class' => '',
'menu' => '',
'menu_class'=> 'nav',
'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: 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 25 2011

How to Add Facebook Tabs via WordPress

First, download and install the Facebook Tabs Manager Plugin by David Carr.

This plugin will get you started on how to begin creating Facebook plugins. John Hayden of Inbound Zombie created a YouTube video on basic usage of Facebook Tab Manager to customize your page.

So try it and get everything set up!


Facebook Tab Manager Shortcodes

[fblike like="0"] PROMO CONTENT[/fblike]
*Only shows to people who have NOT LIKED the page
[fblike like="1"] PROMO CONTENT[/fblike]
*Only shows to people who have LIKED the page
[fbtab query="posts_per_page=5"] or [fbtab query="category_name=clips"]
*Pull content from your blog
*Parameters like="1" like="0" format="excerpt" (or "headline" or "full")
[fbtab]<script>alert("silly example")</script>[/fbtab]
*Placeholder for inline JavaScript inserted in Visual Editor
*E.g., in visual editor,
[js]<script src="http://domain.com/wp-includes/js/jquery/jquery.js" type="text/javascript"><!--mce:0--></script>JQuery(domcuent).ready(function($){$('#eyechart').delay(2000).slideUp(600);});[/js]


Secure v. Regular Connection Issue with Facebook and Facebook Tab Manager

There is a known bug within Facebook. Simply click allow or yes.


IE Scrollbar Problems resolution

However, to make the tab fit within IE standards, I had to make a few adjustments. In my Facebook Tabs Post, I have the following selected:
*Set resize/autoresize (for tabs taller than 800 pixels)
*Hide post title, only show post content words / images

However, I still got a horizontal bar across the bottom (only in IE; how I loathe IE6-8). After trying various CSS hacks, I found adding this to the CSS worked:

[html]html {
overflow-x: hidden;
overflow-y: auto;
}
body {
width: 500px;
margin:0; padding:0; border:0;
overflow:hidden;
}[/html]

Written by Travis Smith · Categorized: Tutorials, WordPress

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

  • « Previous Page
  • 1
  • …
  • 42
  • 43
  • 44
  • 45
  • 46
  • …
  • 60
  • Next Page »

Need Help?

Please let us know how we can help you!

Get Help

Recommendations

Genesis WordPress Framework
Sucuri Security
Gravity Forms
GetSoliloquy
Get Envira
Scribe SEO
BackupBuddy
WordPress Video User Manuals

Recent Posts

  • Solving WordPress 5XX Server Errors on SiteGround
  • Hiding an User in the WordPress Admin
  • Custom Rewrite Rules for Custom Post Types and Taxonomies
  • WordPress JavaScript Manager Native Functions
  • Causes of WordPress Site Performance Slowdown

About Travis

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

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