‘WordPress FAQs’ Category

Create Your Own Frontpage Slideshow

17
responses

The folks over at PerfectSurf.de have published a tutorial which goes into detail on how you can create your own personal slideshow to appear on the frontpage of your WordPress powered site. This slideshow feature has been seen in numerous premium themes as of late and now you can create one for yourself via this tutorial. A slideshow is great for showcasing images within a gallery or showing off images related to top news items on your blog. The tutorial is not meant for beginners, but those of you who understand terms such as The Loop, excerpt and permalink, you should be fine. There are some caveats to this process which are outlined in the requirements: There are many ways of embedding slideshows to your website. This tutorial is based on a WordPress 2.5 installation (with some files customized and of course all files updated that were critical in WP2.5 […]

[Continue Reading...]

How To: Avoid Duplicate Posts

28
responses

A reader writes in: I’m developing a new theme and I’m having trouble getting duplicate posts from showing when running two loops (one standard loop and one from a specific category). Even when I copied the specific code from directly from the codex, it was not working. The Codex article the reader mentioned was regarding the Loop. Although the example shows how to avoid a single duplicate post, it doesn’t show how to avoid duplicating multiple posts. Here’s how to show two individual loops without duplicating posts in either loop. Step 1: Add a ‘posts_where’ Function A WordPress filter is needed to accomplish this, and we’re going to be tapping into the ‘posts_where‘ filter. The reason being is we need to modify the query used for the loop and exclude some posts. Here’s the function we’ll be using called post_strip: function post_strip($where) { global $myPosts, $wpdb; $where .= " AND […]

[Continue Reading...]

Error Management for WordPress Plugins

10
responses
by
on
May 4th, 2008
in
HOW-TO, WordPress, WordPress FAQs

For the past few weeks I’ve been working on a WordPress plugin. One of my goals was to have fancy and relevant error messages. I contemplated writing my own error manager, and even began a very basic one. I experienced hurdle after hurdle, and finally I thought to myself, “Wouldn’t WordPress have its own error manager also?” So I did a quick source-code search and came across the WP_Error class. One of the hurdles I ran into in creating my own error manager was error localization. The WP_Error class makes localizing error messages extremely simple. Adding Error Messages To add an error message, the first thing you’ll want to do is instantiate your own instance of WP_Error. $myErrors = new WP_Error(); The next step is to add in your error messages. $myErrors->add('access_denied', __('You do not have permission to do that.',$myLocalizationName)); There are a few things to notice here. There is […]

[Continue Reading...]

Exporting-Importing A Category

23
responses

When it comes to exporting, WordPress already does a wonderful job with it’s support to export posts, pages, comments, custom fields, categories, and tags. However, there is a problem. The WordPress exporter lacks granularity. What I mean by this is that, the exporter covers the entire blog instead of being able to select certain categories to export. I’ve searched the WordPress Plugin database high and low to look for a plugin that would specifically export categories and I could not find one. I did manage to come across two techniques though that get the job done. There are two ways to export specific categories. The first is to read this forum post where HandySolo explains how to use the category RSS feed to export specific categories from a self hosted blog to a WordPress.com blog. The problem with this method is that, none of the meta data attached to the […]

[Continue Reading...]

Paging and Custom WordPress Loops

94
responses
by
on
April 19th, 2008
in
HOW-TO, WordPress FAQs, WordPress Hack

Last week I published two articles using custom loops. The first was about how to create a custom loop. The second was how to retrieve posts based on custom fields. In both articles, several readers commented that they would like to see paging and have it explained. I’d like to thank Aaron Harun from Anthology of Ideas for supplying the code used in this post. Paging, and why it doesn’t work with WP_Query The paging magic happens in a file called ‘link-template.php‘ in the ‘wp-includes‘ folder. Most themes have basic paging built in, with the help of two functions: next_posts_link and previous_posts_link. These functions, as well as several others, make use of a global variable called $wp_query. This variable is actually an instance of the WP_Query object. However, when we create our own instantiation of WP_Query, we don’t have this global variable $wp_query, which is why paging will not work. […]

[Continue Reading...]

How to Only Retrieve Posts With Custom Fields

32
responses

One question I come across a lot regarding custom fields is how to only retrieve posts based on a custom field. For example, if a post has a custom field of “MyData”, someone might want to only retrieve that particular post. The WordPress Codex has a technique for retrieving posts based on custom fields, which consists of writing your own query and going through the results. The technique in the Codex is good, but I’ve found a re-usable way one can retrieve only posts with certain custom fields. The technique I use makes use of two custom functions placed in a theme’s “functions.php” and a custom WordPress Loop. Let’s get started — The “functions.php” file First, let’s place the two custom functions in the “functions.php” file. This file should be in your theme directory, but if it isn’t there, you can create one using any text editor. Here are the […]

[Continue Reading...]

Define Your Own WordPress Loop Using WP_Query

78
responses
by
on
April 13th, 2008
in
HOW-TO, WordPress FAQs, WordPress Hack

We all know what the WordPress Loop is right? If not, there are many great tutorials around the web that explain the WordPress Loop. One of the easiest ways to navigate and manipulate the loop is to use the function called query_posts. Nathan Rice calls it a WordPress developers best friend. When you use query_posts, however, you risk the following: Potential to interfere with plugins which make use of the Loop. Potential to invalidate WordPress conditional tags. Having to deal with resetting, rewinding, offsetting… I say skip query_posts. In a way you’ll still be using it, but the better (and sometimes easier) technique is to instantiate your own WP_Query object and create your own loop. Creating Your Own Loop With WP_Query The first step is to instantiate your own variable using the WP_Query class. What we’ll be doing in this example is creating a common feature on blogs, which is […]

[Continue Reading...]

Managing Trackbacks and Pingbacks in Your WordPress Theme

43
responses

With all of the recent discussion regarding trackbacks and pingbacks on Weblog Tools Collection, I thought I’d mention several ways one can deal with trackbacks and pingbacks in the context of a WordPress theme. The topics I will be covering in this article are on separating trackbacks/pingbacks from regular comments, and also how to remove trackbacks and pingbacks from a WordPress theme completely. Separating Trackbacks/Pingbacks From Comments I know what you’re thinking: numerous posts have already been written on how to separate trackbacks from comments. But what I present here is an actual separation using the “functions.php” feature for WordPress themes along with the regular “comments.php“. Both should be located in your theme directory. Figure 1: Theme Directory Setup Modifying the functions.php File The “functions.php” file is a lifesaver for any theme developer or tinkerer wishing to add custom code or functions to themes. The code in the “functions.php” file […]

[Continue Reading...]

Two side-by-side columns in WordPress

13
responses

How to organize posts into two side-by-side columns in WordPress: A quick tutorial on setting up the front page of a WordPress blog to display two side by side columns with posts alternating between the two columns. The tutorial does require some simple PHP code that is not included (but should be, pseudo code is provided) but the concept is interesting, especially for theme developers looking for the next new thing. In my experience, side by side posts are more applicable for blogs that are heavy in embedded media and light on text.

[Continue Reading...]



Obviously Powered by WordPress. © 2003-2013

css.php