Wordpress

WordPress List Category Posts without Breaking Sidebar

Wednesday, July 20th, 2011

query_post codex
As I was creating a page template for wordpress, I wanted to list posts from a specific category on a page when I ran into a interesting problem, the query_posts function I was using was causing breaks in the execution of conditional tags like is_page(’25′) in the sidebar template.  I looked around on the web for a while before finally finding the solution that worked for me. So I am rewriting the solution here for reference and so anyone else may find it easier.

Here is how you list posts from a particular category in a wordpress page template, right before the “while (have_posts()) : the_post(); ” call add:

<?php query_posts('category_name=name&showposts=100'); ?>
<?php /*  change name to the name of the category posts you want to display   */  ?>

The reason the wordpress function query_posts() breaks the sidebar template is because its not a simple database query collecting posts from a specific category, but its resetting the query object as a whole to reflect a normal category query.

So to fix the sidebar template you have to go with creating a new query object through WP_Query() in your page template. So here is the before and after of the loop in a page template.

Page Template Loop BEFORE:

<?php query_posts('category_name=name&showposts=100'); ?>
<?php while (have_posts()) : the_post(); ?>
       <!-- do stuff ... -->
<?php endwhile; ?>

Page Template Loop AFTER:

<?php $cat_posts = new WP_Query('category_name=name'); ?>
<?php if($cat_posts->have_posts()) : ?>
         <?php while($cat_posts->have_posts()) : $cat_posts->the_post(); ?>
                 <!-- do stuff ... -->
         <?php endwhile; ?>
<?php endif; ?>

Hope that helps someone, cya.

The Dreamy Spoon Website

Thursday, March 3rd, 2011

Yesterday, I finished developing another website called The Dreamy Spoon. The Dreamy Spoon is a Self Served Frozen Desserts Store located in Maumelle , Arkansas and it a full flash website that also has a wordpress blog with it. This has to be one the most fun websites I have done in a while, partly because of the silliness of the design (which was done by Cody Scott of  Kinetic Media Solutions ). Some of the special things about the website are they it uses SWFAddress to increase SEO and add the ability to go straight to a specific page, as well as a custom MP3 music player, and all the animations were pretty cool too. The website includes everything from a flavors page, a contact page, and links to the social media websites.

One of the hardest things to code for the website was getting the stage to resize correctly when the user resizes the browser window, because the grassy hills had to stay at the bottom and the cloud background had to scale correctly.

To increase SEO, I created the The Dreamy Spoon Blog (made from WordPress) that the owner could add news posts and I also duplicated the flash pages  into wordpress pages and basically hide them from the user (meaning no actual links to them), but when I submit a sitemap to Google Web Mastertools I will include those links so they get indexed.

This might be the best flash website I have done so far and it was a lot of fun to work on, let me know what you guys think.

Cya

Richard Godwin Website

Thursday, October 14th, 2010
Richard Godwin Website Richard Godwin Blog - Welcome to the Slaughterhouse

I have finished working on another freelance website for a client, its called richardgodwin.net, and as you probably guessed it was for a person named Richard Godwin.  Richard is a really talented writer of dark crime fiction and noir,  and is about to publish his book, called ‘Apostle Rising.’  He had two blogs already that he consistently updated, so it was an obvious choice to build his site off of the WordPress Framework. Another reason I built the site using the WordPress framework is because of the awesome admin section it has. It really does do a great job in allowing the client to change the content on the website whenever they want, especially when they don’t have any coding knowledge.

As I worked on the site, Richard hired a graphic designer named Matthew Swann to finalize some graphics for the site. I usually do the graphics as well for the sites I work on, but it was a nice change of pace to have some help and it was really great working with Matthew.

There are a few special things I did for this site, that I want to list off here. There was a great plugin called WordPress.com Stats from their old site, that I implemented into their new site that lets them view their hits and pageviews from the WordPress dashboard. There were some problems initially with it but I fixed it by going into phpMyAdmin and messing with some fields in the SQL database.  For the navigation of the website and blog, they really liked the CSS Horizontal Menus I found on http://www.cssmenumaker.com. So I implemented one of those into the theme, and changed the color around to go with the rest of the site a little better. Another cool item on the site is the Steel Melting Flash Text Effect in the banner. I bought the file from activeden and added it to the site on two different pages. I think it looks really great and it achieved the flashy effect that Richard was wanting for announcing his upcoming book.

The last thing I want to talk about is the new default theme for WordPress called Twenty Ten. I created his blog theme from the Twenty Ten Theme and I just wanted to say that it was really easy to work with and modify, and that it comes with a ton more admin options in the dashboard area that the old default theme was really missing. My hat goes off to the WordPress team as they constantly raise the bar of their product again and again.

Cya

WordPress and Flash 10x Cookbook Review

Friday, June 25th, 2010

As you may know, I have completed quite a few projects and written several posts regarding the integration of Flash and WordPress. In fact, my latest project was a complete Flash and WordPress Website called RocFolio 2.

A few weeks ago I was excited to be contacted by Packt Publishing. They asked me to review one of their books, “WordPress and Flash 10x Cookbook”. I was honored that they contacted me and excited for the opportunity to read through their book and see what I could learn. Here is the book information followed by my review.

Book Information

Full Title: WordPress and Flash 10x Cookbook
Author(s): Peter Spannagle, Sarah Soward
Pages: 268
Published: April 2010
Publisher: Packt Publishing
ISBN: 978-1-847198-82-2

My Review

The book as a whole is written well and includes over 50 simple and effective techniques on how to control certain tasks relating to Flash content in WordPress. The easy-to-follow step by step instructions, and pictures to help out those of us who are more visual, that accompany the techniques make integrating Flash and WordPress a fairly straightforward process.

This book is aimed at new or intermediate WordPress users who are interested in learning how to create the unique and media-rich sites that using plug-ins and Flash can provide, so much of the book’s content I was already fairly familiar with.  But for the newer user looking to enhance their personal or business sites and blogs, this book definitely contains strategies and techniques to help you do just that. Just remember that a working knowledge of XHTML, CSS, and graphic design is helpful and familiarity with WordPress is required, because the book does not address the basic mechanics of using WordPress itself. Also, any previous experience with Flash is helpful but not necessary.

Honestly, the Cookbook focused more on how to add, edit, and embed Flash into WordPress than an actual integration of the two, which is what I had originally thought it was going to be about. It also mentions several really nice WordPress plug-ins, some of which were strictly for helping you add and control Flash on your WordPress site, while others mentioned are to help you with SEO, Google Sitemaps, and optimizing your WordPress site as a whole. The Cookbook also delves into some Actionscript 3.0 scripting which is followed by examples paired with actual code. Here are links to some of the plug-ins the book mentions that I found to be particularly helpful tools in building a WordPress site:

Kimili Flash Embed Plugin
Dean’s FKCEditor  Plugin
Google Sitemaps XML Plugin
SEO Title Tags Plugin
FLV Embed Plugin

If you don’t know how to use these plug-ins, or have an overall desire to learn more about Flash content within WordPress, the WordPress and Flash 10x Cookbook definitely explains in detail the best way to do so. Overall, this book is a great reference and would be a helpful addition to your desk or workspace, especially if you’re a new or intermediate designer/developer. Hey, even if you’re an advanced user it could still come in handy, teaching you something you might have missed along the way as you taught yourself… we all have something to learn. Right?

Cya

Housemadehome.net Website

Wednesday, May 19th, 2010

I have finished up another website for a client of mine (my wife), designed for her blog called housemadehome.net. The blog chronicles the renovations and decorating of our house, some recipes, and stories associated with the raising of our family. I worked really closely with her on the design of the site and I think it came out really well. I developed it using the WordPress backend, so she could easily make posts to it and handle the whole site by herself. We focused a lot on search engine optimization and the site has had a really good start so far… she has over 15 followers already. There are tons of home design blogs out there and they are getting bigger all the time. If you are looking for a custom made blog template, contact me so we can discuss the details of the project.

Cya