Archive for the 'Wordpress' Category

Comment Notifier Plugin for Wordpress

When someone would comment on my clients blog, I would get the email to allow or deny the comment. I could simply ignore these emails, or forward them to the client. Rather than forwarding the email, what if I had the ability to add to the list of people receiving the comment notification?

Comment Notifier does just that very easily. Now I can put in my clients email so they can be notified about comments on their blog!

Extend Wordpress Part 3 - Templates

Today we’ll learn how templates work pertaining to categories and how to format those custom fields on our live site.

Categories Part A - ID Lookup & Create a New Page:
The first thing we need to do is to learn which id numbers go with which categories. Manage » Categories (in the WP Admin) will show you a list of your current categories and their ID numbers. In this example, we will take note of ‘Listings’ with the ID #3. If you navigate to this ‘wp-content/themes/default2′ directory (assuming you downloaded this theme from earlier and are using it), you will find a series of files including page.php. Open ‘page.php’ and save it as ‘category-3.php’. Where 3 is the category id number of the ‘Listings’ category in this example. We will be working on this new ‘category-3.php’ file soon, but first we need to grab a new plugin.

Part B - Install a New Plugin:
Download and install the Get Custom Field Values plugin. We will be using this plugin to display our extra data on our new ‘category-3.php’ file or rather our new Listings page.

Part C - Finding & Adding Code:
Find this line of code: <?php the_meta() ?> in your file and remove it. If you do not find this, make yourself some room right after this piece of code:

<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>

by entering some new lines.

Now we can add this code:
<?php echo c2c_get_custom('Price', '<strong>Price:</strong> ', '<span>|</span>'); ?>

Repeat this process for your other custom fields.
Your final category-3.php file may look like the following:

<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php echo c2c_get_custom('Price', '<strong>Price:</strong> ', ' <span>|</span>'); ?> <?php echo c2c_get_custom('Location', '<strong>Location:</strong> ', ' <span>|</span>'); ?> <?php echo c2c_get_custom('Agent', '<strong>Agent:</strong> ', ''); ?><br />
<?php echo c2c_get_custom('Beds', '<strong>Beds:</strong> ', ' <span>|</span>'); ?> <?php echo c2c_get_custom('Baths', '<strong>Baths:</strong> ', ' <span>|</span>'); ?> <?php echo c2c_get_custom('Acres', '<strong>Acres:</strong> ', ' <span>|</span>'); ?> <?php echo c2c_get_custom('Status', '<strong>Status:</strong> ', ''); ?><br />
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Save this page and upload it to your the ‘wp-content/themes/default2′ directory. You should end up with something similar to the screen shot below if you navigate to this address…. ‘yoursite.com/category/listings/’

New Listing

 

Tips:

  • Visit this page to learn more about the Wordpress template system.
  • Make sure all of your new real estate listings are assigned to your ‘Listings’ category when you create a new post.
  • Make sure your new category-#.php has the same ID as your ‘Listings’ category and is uploaded to your current themes directory.
  • Your new code consists of 3 parts. P1 - the name of your custom field; P2 - the contents before the value of the field; P3 - the contents after the value of the field. <?php echo c2c_get_custom('P1', 'P2', 'P3'); ?>
  • Put your questions on the comment section of this post. You might have a similar problem or question that I can post the answer to!

Extend Wordpress Part 2 - Admin

In my first post, I went over how to extend wordpress using custom fields. Here in Part 2, you’ll learn how to make the custom fields look better on the admin side of things. This will make it not only easier for you, but for your clients and users as well.

Note: Since I last posted, Wordpess 2.2 was released. The techniques I’m showing you should work fine in Wordpress 2.1 or 2.2. With that being said, lets get started.

  1. Download and install the Custom Field GUI plugin on your site. (Don’t forget to activate it)
  2. Download this file, extract the conf.ini file and upload it to your wp-content/plugins/rc-custom-field-gui/ directory
  3. That’s it! You should now end up with the screenshot below when you go to write a post.

Wordpress Admin

 

It looks a lot nicer doesn’t it? Now you have form fields for price, agent, bedrooms etc. It is possible to create an an unlimited number of fields and the plugin also offers the ability to create dropdowns, radio buttons, and text area boxes. I simply made this basic one to show you what’s possible. Please comment with your suggestions so I may improve it the next time around.

Move on to Part 3 - Templates.

Extend Wordpress Part 1 - Custom Fields

One of the challenges with running Wordpress as a CMS (per my previous post) is being able to extend the core features to accomplish the goals for your site. These next series of articles will examine how to get more out of Wordpress than you had ever thought possible. For example purposes, we are going to create a Real Estate site powered by Wordpress 2.1.3. Lets get started…

  1. Write » Posts » and then enter a title… “Two Bedroom Ranch with a View”
  2. You might also want to add a new category called “Listings” if you haven’t already.
  3. In the post box, add a description about your property, upload some photos etc.
  4. Enter a new key… “Price” and a value… ” $150,000″ » click Add Custom Field
  5. Repeat Step 4 for each value. For example, you might want to add Agent, Status, Beds, Baths etc. Then publish your post when you’re done.

Tip: Every time you add custom field (key), it will appear in the dropdown box the next time you add a post/listing. You don’t need to type it in again!

Wordpress

 

Now all we need to do is get the information to display on your site. I have made available a modified version of the default theme in wordpress. Simply download this theme, extract the files, upload it to your wordpress themes directory and activate it. It’s called ‘Wordpress Default 2′.

Keep checking back as future articles will discuss how to make these custom fields more visually appealing both in your admin and on your live site.

Move on to Part 2 - Admin.

Why Wordpress?

WordpressWordpress is probably one of the best pieces of software for blogging on the web. Since it runs entirely off of your web server, it is incredibly powerful and useful. One of the things I like about it is that it’s just as powerful when used as a CMS (content management solution). The big misnomer is that Wordpress is only for blogging… it’s not!

Every site I create uses Wordpress for several reasons. Clients are able to easily update their content, friendly urls are easy to create (great for search engines) , and all of your content can be searched from within your site!

If you design many sites, or run your own personal site, I recommend using Wordpress for your needs. Your clients will love it and you’ll love it!

In the coming weeks, I plan to highlight some great plugins I use for Wordpress along with other tips and tricks.