WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

May 03 2011

How to Add a Twitter Share Button to Your Post Info in Genesis

Simply add the following code to your functions.php file.

[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] [ post_comments] | Share: <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> '; //remove spaces after initial [
//$post_info = 'Custom text'; //edit this to whatever you'd like.
}
return $post_info;
}[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

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

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

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