WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Mar 16 2011

How to Make the Top-Level Menu Items Non-clickable in WordPress Custom Menus

Whether you use Genesis or not, one often question I see is: "How do I make the top-level items non-clickable?" And they go on to say that they are linked to a category, a landing page, a blank page, a random 404 page, etc. However, it is quite simple.

First, for Genesis users, ensure that you have selected Custom Menus in Genesis > Theme Settings. Then, navigate to the custom menus option via Appearance > Menus.

Second, create the custom links menu item by filling in the URL as "#" (without the quotes) inserting a label name, then clicking Add to Menu. Then locate it anywhere on the menu and click Save Menu.

DONE!

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 15 2011

Add Custom CSS File Based on Page Type: Front Page, Home Page, Category Page, Archive Page, 404 Page, Author Page, and Page

So I found one question that I read that asked how to have a custom CSS file per page. Here's an easy way to add custom CSS files based on simple conditional logic in Genesis.

[php]
remove_action('genesis_meta', 'genesis_load_stylesheet'); //removes current stylesheet
add_action('genesis_meta','genesis_custom_css');
//get_bloginfo('stylesheet_url') is our normal style.css
function genesis_custom_css() {
if (is_category())
echo '<link rel="stylesheet" href="'.CHILD_DIR.'/css/cat_style.css" type="text/css" media="screen" />'."n";
if (is_home() || is_front_page())
echo '<link rel="stylesheet" href="'.get_bloginfo('stylesheet_url').'" type="text/css" media="screen" />'."n";
if (is_archive())
echo '<link rel="stylesheet" href="'.CHILD_DIR.'/css/arch_style.css" type="text/css" media="screen" />'."n";
if (is_author())
echo '<link rel="stylesheet" href="'.CHILD_DIR.'/css/auth_style.css" type="text/css" media="screen" />'."n";
if (is_page()) //also can take $pages=array(1,2,3); adding and elseif or else at the end.
echo '<link rel="stylesheet" href="'.CHILD_DIR.'/css/page_style.css" type="text/css" media="screen" />'."n";
if (is_404())
echo '<link rel="stylesheet" href="'.CHILD_DIR.'/css/page_style.css" type="text/css" media="screen" />'."n";
}
[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 14 2011

Genesis Expose Category Template Matching Homepage

When I was checking out Expose Child Theme at StudioPress, I was slightly disappointed that when I clicked on a category that it didn't resemble the homepage in any way. Personally, I would love to see an option in Theme Settings that asked whether I wanted to have my category archive pages to reflect the homepage or a normal category archive page as they have now. While I have taken the home template and dubbed it into a category template, more things can easily be added. If you want to download the file: [download id="3"].

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 13 2011

How to Widgetize the Home Page of the Expose Genesis Child Theme

In order to widgetize the Expose Child Theme, you have to do three things.

1. Edit the CSS to make .portfolio-posts absolute. So find the following CSS.

[html]#content .portfolio-posts, {
background: #FFFFFF;
float: left;
width: 280px;
min-height: 280px;
margin: 0 10px 10px 10px;
padding: 9px 9px 9px 9px;
border: 1px solid #D5D5D5;
display: inline;
-moz-box-shadow: 0 0 3px #BBBBBB;
-webkit-box-shadow: 0 0 3px #BBBBBB;
overflow: hidden;
}

#content .portfolio-posts h2 {
font-size: 18px;
}

#content .portfolio-posts p {
line-height: 20px;
}[/html]

and delete #content.

2. Edit functions.php to include the widgeted area. Add the following code after // Register widget areas:
[php]genesis_register_sidebar(array(
'name'=>'Home 1',
'id' => 'home-1',
'description' => 'This is the first section of the homepage.',
'before_title'=>'<h3 class="widgettitle">','after_title'=>'</h3>'
));
genesis_register_sidebar(array(
'name'=>'Home 2',
'id' => 'home-2',
'description' => 'This is the first section of the homepage.',
'before_title'=>'<h3 class="widgettitle">','after_title'=>'</h3>'
));
genesis_register_sidebar(array(
'name'=>'Home 3',
'id' => 'home-3',
'description' => 'This is the first section of the homepage.',
'before_title'=>'<h3 class="widgettitle">','after_title'=>'</h3>'
));[/php]

3. Edit home.php to incorporate the widget. Then comment out the following:
[php]//require_once(PARENT_DIR . '/index.php');[/php]

And add the following just after that:
[php]get_header();
genesis_home(); ?>

<div id="content home-widgeted">
<div class="widgeted-home home-1">
<?php if (!dynamic_sidebar('Home 1')) : ?>
<div class="widget">
<h4><?php _e("Home", 'genesis'); ?></h4>
<p><?php _e("This is a widgeted area which is called Home.", 'genesis'); ?></p>
</div>
<?php endif; ?>
</div><!-- end .widgeted-home home-1-->
<div class="widgeted-home home-2">
<?php if (!dynamic_sidebar('Home 2')) : ?>
<div class="widget">
<h4><?php _e("Home", 'genesis'); ?></h4>
<p><?php _e("This is a widgeted area which is called Home.", 'genesis'); ?></p>
</div>
<?php endif; ?>
</div><!-- end .widgeted-home home-2-->
<div class="widgeted-home home-3">
<?php if (!dynamic_sidebar('Home 3')) : ?>
<div class="widget">
<h4><?php _e("Home", 'genesis'); ?></h4>
<p><?php _e("This is a widgeted area which is called Home.", 'genesis'); ?></p>
</div>
<?php endif; ?>
</div><!-- end .widgeted-home home-3-->
</div><!-- end #home-widgeted -->

<?php get_footer(); ?>[/php]

Now, Expose Home Page is widget ready to give more control on the front page. You may need to add some CSS to style even further.

Written by Travis Smith · Categorized: Genesis, Tutorials

Mar 11 2011

Create a Widgetized Ad Area for Genesis

To add ads at the bottom of the posts, you can add ad content space. A good way would be to widgetize it and use Widget Logic to control what ad appears on what page, etc.

So, add this to your functions.php file.
[php]genesis_register_sidebar(array(
'name'=>'Ad Content',
'description' => 'Place widgets here to fill the ad content area that appears after posts.',
));
function add_ad_content() { ?>
<div class="ad_content">
<?php if (!dynamic_sidebar('Ad Content')) : ?>
<h3><?php _e("Ad Content Area", 'genesis'); ?></h3>
<p><?php _e("This is a widgeted area designed to hold ad content.", 'genesis'); ?></p>
<?php endif; ?>
</div><!-- end .homepage_content -->
<?php }
add_action ('genesis_after_post_content','add_ad_content');[/php]

Written by Travis Smith · Categorized: Genesis, Tutorials

  • « Previous Page
  • 1
  • …
  • 16
  • 17
  • 18
  • 19
  • 20
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

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