Category Archives: Custom Design

How to Remove Drop-down Menus

If your drop-down menu is being generated with a version of the wp_list_categories function, you can add into the parameters (or change them) to read with … &depth=1. For example:

<?php wp_list_categories('title_li=&depth=1); ?>

This will only display top level, or parent, categories.

Show Only Children of Page in Sidebar

Wow, so that’s quite the mouthful right?

When I first attacked this, I thought it would be quite tricky… was both right and wrong. ;)

Find your sidebar.php, then place the following php edit code within the ‘ul’:

<div id="sidebar">
<ul class="xoxo">
	<li id="pages">
<ul>
		<?php
		 if($post->post_parent)
		$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
		else
		$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
		if ($children) { ?>
<ul>
		<?php echo $children; ?></ul>
<?php } ?></ul>
</li>
</ul>
</div>
<!-- #sidebar -->

Explanation of the above code can be found here at WordPress Codex. They’re better than I am at the ‘techy talk ‘ of the ‘why’s’ ;)

After all that is put in place, should look like this:

SubPagesOnSidebar

Aligning 2 Column Design Using CSS

CSS can be tricky. Divisions piling up on top of each other is never any fun, and can drive you mad – ESPECIALLY when you find out ONE declaration changed makes ALL the difference! But what IS that declaration that makes ALL the difference?!

2columncss

Here is the skeleton of the 2 column, typically found in the page.php file:

<?php get_header() ?>
<div id="canvas">
<div id="content">

<?php the_post() ?>
<div id="post-<?php the_ID() ?>" class="<?php post_class() ?>">
<h2 class="entry-title"><?php the_title() ?></h2>
<div class="entry-content">
<?php the_content() ?>

<?php wp_link_pages('before=
<div class="page-link">' . __( 'Pages:' ) . '&after=</div>
') ?>

<?php edit_post_link( __( 'Edit'), '<span class="edit-link">', '</span>' ) ?></div>
</div>
<!-- .post -->

<?php if ( get_post_custom_values('comments') ) comments_template() // Add a key+value of "comments" to enable comments on this page ?></div>
<!-- #content -->
<?php get_sidebar() ?>
<div class="fixed"></div>
</div>
<!-- #canvas -->

<?php get_footer() ?>

Now, bring in the design from the style.css file:

#canvas {
width: 950px;
margin-left: auto;
margin-right: auto;
padding-bottom: 9em;
}

#content {
width: 730px;
float: right;
overflow: hidden;
}

#sidebar {
width: 220px;
float: left;
margin-top: 2em;
overflow: hidden;
}

.fixed {
clear: both;
}


Remember, that the typical layout will follow progressively from outer to inner: HTML >> BODY >> Wrapper >> Header >> Navigation >> Container (or in the example above ‘ canvas ‘) >> Content >> Sidebar >> Footer. Make sure your CSS file follows progressively in this form, so it can load effectively & accurately. Feel free to share your thoughts below in a comment! :)

Creating 2 Navigations into WordPress Theme

Ever wanted to make it easy for your clients to have 2 navigation’s to easily add to? Usually you’d want 2 navigation’s if they are designed in separate locations.

2NavsWordpressTheme

<div id="menu">
<ul>
		<?php $params = array(	'before' 	=> 	'
	<li>',
				                'after'  	=> 	'</li>
',
				                'title_li' 	=> 	'',
				                'exclude' 	=> 	26,
				                'depth'	=> 1				);
					   wp_list_pages($params);
					?></ul>
</div>
<!--#menu-->
<div id="utilityNav">
<ul>
		<?php $params = array(	'before' 	=> 	'
	<li>',
				                'after'  	=> 	'</li>
',
				                'title_li' 	=> 	'',
				                'include' 	=> 	26			);
					   wp_list_pages($params);
					?></ul>
<!--#utilityNav--></div>

A better explanation than I could ever give will be found in WordPress Codex here. This will explain why the settings above work, in their excellent ‘techy talk’. ;) The ’26′ as shown above is the ‘Contact Us’ page as shown in the image example [above]. As of right now, I haven’t yet figured out how to not have to come back into the header and add page numbers to ‘exclude’ and ‘include’ when you do add a new page. If you know this before I come back and update this post, please share your ‘how to’ in a comment below! :) Thanks! ♥