• .
  • .
  • .
  • .

Display Posts From A Category In WordPress

Posted in WordPress | Posted on Date 01-25-2012 | Comments 5 Comments
Tags: ,

wordpress-tricks

Recently I had a run in with coding with a client who had a developer put together a sloppy custom WordPress query in place of a proper loop. In fact, it was amazing because it was put in replace of code on a great premium theme by StudioPress. By the way, no it was not StudioPress who did it, so let me get that out of the way. They are good at what they do. :)

Anyhow, the custom query was three different pieces of code: a section to show to first 5 most recent posts, and then two columns underneath to show two different categories that the site owner wanted to feature. The was done using a similar solution to the one At Weblog Tools Collection called Define Your Own WordPress WP-Query.

The problem was that this solution was not providing a good pagination. The “Next” and “Previous” did not work, and even if I wanted to use my favorite WP-PageNavi plugin, then I was pretty much – “sorry, out of luck.” This does not work well as a replacement for the regular loop, especially for what it was being used as.

So, I set out to put together a better solution. In the end, I displayed the most recent posts by normal Loop means. For the categories, I used the following:


<?php $recent = new WP_Query(); ?>
<?php $recent->query('cat=1&showposts=3'); ?>
<?php while($recent->have_posts()) : $recent->the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></h3>
<div class="attachment-post-thumbnail">
<?php the_post_thumbnail(); ?>
</div><?php the_content_limit(130, ""); ?>
<?php endwhile; ?>

We are still using a custom WP_Query, but only using it for the categories. You can replace the 1 after cat=1 to whatever category you want to display, and you can change the number of posts displayed by changing the number in showposts=3.

You can customize the code further with CSS and adding other attributes.

I left some styling to include the thumbnail, title, and a short excerpt, even using the_content. However, you can change it to the_excerpt if you have set your excerpts through your functions.php or excerpt plugin. This code goes in your WordPress theme template where you want it, however I use this normally for the theme’s template file that is for the front page of the website. This is good for sites that are more magazine-like.

Sound easy?

WordPress Pages Versus Posts, Which to Choose

Posted in WordPress | Posted on Date 01-21-2012 | Comments 49 Comments
Tags: , , , ,

wordpress-cat-thumb
So you have content, but you are not sure you want to go with pages or posts. Well, it really is not that difficult. A lot of people put together a site completely in posts without few pages. Or they make a page and enable comments, depending if their theme has that coded into the page template. Even you can customize individual pages, since WordPress 3.0, you can customize individual posts. You also have the ability to adjust your menu from your WordPress admin panel to whatever you like if you have the wp_nav_menu php call into the theme itself. Read More →

How to Display A User Welcome Message In WordPress

Posted in WordPress | Posted on Date 01-18-2012 | Comments 40 Comments
Tags: , ,

wordpress-tricks
Whether you just like to put up a personal greeting or have a site that has quite a few users, something a welcome message is nice. I have seen a few people put this together and have a centralized paged where users can log in, read the personal message, and then go on their merry way using the website. The code is really simple. This code calls the current user. If you want to only let people like contributors or other roles see the message, you have to adjust the level_0 to any of the levels corresponding with the roles. Read More →

WordPress Plugin Review: Theme My Profile

Posted in WordPress | Posted on Date 01-18-2012 | Comments 16 Comments
Tags: ,

wordpress-plugins
In fact, I have been exercising this on a few sites for clients that wanted their users to not even be lead to the WordPress backend, even to edit their user profile. Theme My Profile works well with the plugin Theme My Profile, and were both created by Jeff Farthing. Of course, you can use this plugin by itself as mentioned on Jeff’s page for the Theme My Profile plugin. This plugin is a very nifty tool and eventually I will have it so profiles will be viewable too. Everything just takes time. The plugin works great and I have Read More →

WordPress Plugin Review: Theme My Login

Posted in WordPress | Posted on Date 01-17-2012 | Comments 15 Comments
Tags: ,

plugins-cat-thumbnail
I found a nifty WordPress plugin and this one themes your login page to conform with your current layout. It is called Theme My Login and it was created by Jeff Farthing. Now, this is different from the tutorial on theming your WordPress login page. As further explained on Jeff’s site, his plugin overrides the wp-login.php and profile.php pages. The plugin includes a widget you can place a login form in your sidebar too! Jeff offers a support forum for his plugin… well actually, he has authored a few plugins. As a side note, I will be blogging about another Read More →

Got WordPress Questions? Come Join Us for #WordPressWednesday on Facebook!

Posted in News | Posted on Date 01-17-2012 | Comments 11 Comments
Tags: , ,

wordpresswednesday
Somedays WordPress Can Make You Want To Pull Your Hair Out! That’s why we’ve added a new weekly event for you to Kimberly Castleberry’s Facebook Fan page! Hey everyone, I’m Kimberly Castleberry and for those that don’t know me I’m a WordPress tech that specializes in supporting small and home business owners in getting the most from their WordPress sites without having to become geeks themselves! I run a number of events including #TribeTuesday and #FanPageFriday on my page throughout the week that provide you with opportunities to promote others as well as yourself. Check them out for more details. Read More →

Blondish.net Podcast – Blogging and SEO

Posted in Podcast | Posted on Date 01-17-2012 | Comments 13 Comments
Tags: , , ,

blondishnet-podcast
Episode 2 of the Blondish.net Podcast is a little beginner coverage on blogging and SEO. I wanted to cover basics on SEO for the content and design. I do recommend in this post the plugin WordPress SEO by Yoast. I go over some advice for writing the title and the content of a post as well as a few tips for designers. As a reminder, this is a basic SEO. I will cover some advance SEO in future podcasts. The episode is a little over 15 minutes. Blogging and SEO

Brand Your WordPress Login Page Without A Plugin

Posted in WordPress | Posted on Date 01-17-2012 | Comments 9 Comments
Tags: , , ,

wordpress-tricks
There is a Custom Admin Branding plugin for that, but why bother when you can insert a few lines into your theme’s functions.php file? However, if you like to change up your site’s theme sometimes, you probably want to change the log in page too. A lot of people have been really hooked into branding their WordPress log in page, especially since guest blogging has become popular. Here is the code I put together for Blondish.net. This is all merely adding CSS and an action to your theme’s functions.php file. (Note: some people like to be tidy and can put Read More →