4 things I learned making Wordpress into a CMS

4 things I learned making Wordpress into a CMS Thumbnail Image

I recently had the awesome experience of making Wordpress into a small website for a client and it taught me a lot of things both for coding the theme and making the clients life easier. I’ll go over what I think are the five biggest things I learned.

Widgetized Sidebars (Dynamic Sidebars)

This was the single biggest help to me. The site design called for a links area at the bottom to link to other groups and departments and organizations related to this one. It also called for contact information at the bottom.

The solution is to use widgetized “sidebars” and then tweak the css to to turn your sidebar into a footer. To add a sidebar insert this code into your functions.php file in your theme.

<?php
 if ( function_exists('register_sidebar') )
 register_sidebar(1);
?>
</php>
 
You can repeat this code for as many sidebars as you need. Just make the "1" into a different number.
<span id="more-397"></span>
Now insert this code where you want your  sidebar to appear.
 
<pre lang="php">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar(1) ) : ?>
<?php endif; ?>

This will make your dynamic sidebar appear. For me i just fixed the widths of the widgets and floated them left with this code.

#footer .widget{
width:290px;
float:right;
}

By setting the width of the widgets and floating them to the left of my footer I made an editable content area the didn’t interfere with the post or page structure using widgets and dynamic sidebars.

Custom Loops

For the site i was making there wasn’t going to be a blog but rather a news section and an events section so i needed to split the posts be category and query them individually.

<?php
 $news= 'category_name=news&orderby=date&order=DEC&showposts=3';
 query_posts($news); // run the query
 ?>

This snippet created a new query called news ($news) grabs 3 posts from the news category and orders them descending by date. You then set up The Loop normally below this code. My completed loop looked like this.

<?php if (have_posts()) : ?>
	<?php while (have_posts()) : the_post(); ?>
	<?php
		if ( $news%2 ) {
    		echo "<li class='news_even'>";
			} else {
    		echo "<li class='news_odd'>";
			}
			?>
			<h3 class="smallindent"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
			<p class="posted smallindent"><?php the_time('m-d-y') ?> </p>
			<div class="smallindent"><?php the_excerpt(); ?></div>
		</li>
		<?php $news++ ?>
	<?php endwhile; ?>
	<?php else : ?>	
	</ul>
	<?php endif; ?>

Drop Down Menus

The clients wanted the website to have a drop down normally i would oppose it but they had quite a bit of content they wanted to put on the site. After looking around for several hours and testing various methods for dropdown menu. I found this, it turned out to be the holy grail I was looking for and cross browser to boot. and it worked out of the box with the markup generated by wp_list_pages function.

Simplify the Admin Panel

After the first meeting and training session I wanted a way to hide various parts of the admin panel that were going unused. The theme was stripping Wordpress back to the core. No tags, no need to manage categories, or the media library. The solution was wplite. This nifty plugin lets you disable panels in the admin screen. It also lets you limit the post metadata fields (i.e. excepts, post tags, page order, templates, slugs ect.) it turned out to be the magic bullet I was looking for the make managing the site simple and easy. It can even strip the dashboard so the default page is writing a new post.

The next challenge

the next large project I have is to rebuilding the ASDA website with wordpress. With all the bells and whistles and more. The current proposal is.

  • Multi-author blog
  • Post by email for the discussion mailing list.
  • Possibly hosting an ezine
  • membership directory for the group
  • links feed
  • member portfolios

I’ll be publishing more on the development of the site once the group who is designing it throws more at me to code and when we get more ideas.

10 Comments