Create a contact page in WordPress 3.0
We know there are hundreds of plugins to let you host a contact form in WordPress, but I am going to show you how to create your own one.
We are about to create a custom contact page that will work under WP 3.0, and more precisely with Twenty Ten theme. Obviously, with some minor changes you will be able to do the same in your theme.
The script
Let’s start: in your theme folder, create a new file called contact.php (or whatever other name with php extension) and write this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | < ?php
/*
Template Name: Contact me
*/
if($_POST[sent]){
$error = "";
if(!trim($_POST[your_name])){
$error .= "<p>Please enter your name";
}
if(!filter_var(trim($_POST[your_email]),FILTER_VALIDATE_EMAIL)){
$error .= "<p>Please enter a valid email address</p>";
}
if(!trim($_POST[your_message])){
$error .= "<p>Please enter a message</p>";
}
if(!$error){
$email = mail(get_option("admin_email"),trim($_POST[your_name])." sent you a message from ".get_option("blogname"),stripslashes(trim($_POST[your_message])),"From: ".trim($_POST[your_name])." < ".trim($_POST[your_email]).">\r\nReply-To:".trim($_POST[your_email]));
}
}
?>
< ?php get_header(); ?>
<div id="container">
<div id="content" role="main">
< ?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" < ?php post_class(); ?>>
<h1 class="entry-title">< ?php the_title(); ?></h1>
<div class="entry-content">
< ?php if($email){ ?>
<p><strong>Message succesfully sent. I'll reply as soon as I can</strong></p>
< ?php } else { if($error) { ?>
<p><strong>Your messange hasn't been sent</strong></p><p>
< ?php echo $error; ?>
< ?php } else { the_content(); } ?>
<form action="<?php the_permalink(); ?>" id="contact_me" method="post">
<input type="hidden" name="sent" id="sent" value="1" />
<ul class="contactform">
<li>
<label for="your_name">Name</label>
<input type="text" name="your_name" id="your_name" value="<?php echo $_POST[your_name];?/>" />
</li>
<li>
<label for="your_email">Email</label>
<input type="text" name="your_email" id="your_email" value="<?php echo $_POST[your_email];?/>" />
</li>
<li>
<label for="your_message">Message:</label>
<textarea name="your_message" id="your_message">< ?php echo stripslashes($_POST[your_message]); ?></textarea>
</li>
<li>
<input type="submit" name = "send" value = "Send email" />
</li>
</ul>
</form>
< ?php } ?>
</p></div><!-- .entry-content -->
</div><!-- #post-## -->
< ?php endwhile; ?>
</div><!-- #content -->
</div><!-- #container -->
< ?php get_sidebar(); ?>
< ?php get_footer(); ?> |
Now let’s see what we’ve done: Read more
WordPress 3.0 “Thelonious” released
WordPress new major release is here!!!
Named Thelonious after the american jazz composer Thelonious Sphere Monk (October 10, 1917 – February 17, 1982), will represent a revolution in WP community.
Major new features in this release include:
- a sexy new default theme called Twenty Ten
- Short links support
- Custom backgrounds
- Custom headers
- Custom shortlinks
- Custom menus
- Custom post types
- Custom taxonomies
- Multi users support
- Contextual help in admin area
And obviously… it works with Triqui MochiAds arcade theme and plugin.
Now it’s time to dive into theme development!!
How to list all WordPress posts with the same custom field value
When I celebrated my four years of blogging I also introduced a big problem this blog is facing: there is so much content it’s not easy to find what you are looking for.
I received some interesting suggestions, and one of them is to link all posts of the same series. This is what a reader said: “In the first post, put a link of all the steps (requires manual editing)”.
I found a way to put an index on each post of a series using custom fields, and I am sure you’ll find it interesting. Let’s take Create a Flash game like Rebuild Chile series as example.
I want, in every post of the series, to show the full list of posts of the series. Without a lot of manual editing, of course.
So, that’s what I did: first, for every post of the series, I added a custom field called series with Create a Flash game like Rebuild Chile value. The idea is to add a series custom field to every post in every series with a proper value.
If you don’t know how to add a custom field, here it is a little help:

At the end of the Post page admin, you’ll find the form to add new custom fields. That’s how I added series custom field. Now, a few lines of code to rule them all… this is what you have to include somewhere inside the so-called WordPress Loop: Read more
Playing with Google Font API and WordPress
With new webdesign trends, standard fonts such as Arial, Times and Verdana aren’t enough to give our blog/website the loon&feel we want.
That’s why today we’ll discover the magic of Google Font API.
The Google Font API lets you include in your pages high-quality web fonts provided by the Google Font Directory.
This means you can use custom fonts in your design, and they are hosted and served by Google.
That’s nothing new, since services like
But unlike cufòn, texts rendered with the Google Font API are selectable, and there isn’t any copyright issue, and unlike Typekit, Google Font API is free.
So let me show you the simplest example… Read more
War to hackers – The aftermath
As you should know if you are an old time reader, this blog has been hacked several times with malicious script injection.
I tried to secure the blog in every possible way without any luck.
Finally, I think I figured out what allowed hackers to exploit the blog. I use a custom theme built on an old version of Silhouette theme by Brian Gardner.
As you can see from the link, the theme is not longer available for download, but I believe the file comments.php contains a vulnerability.
Here it is: Read more
Loading WP posts with Ajax and jQuery – a real world example
If you are looking for a real world example made with Loading WordPress posts with Ajax and jQuery or you haven’t played LineBall yet, or you played it, you loved it and you want to know who made the music, this is the right blog post.
I am finishing and polishing LineBall’s official site built with WordPress and Ajax.
I plan to finish it before this week ends, then release the theme next week. So if you have suggestions, feedback or want more information, this is your turn.
Help me to make the ultimate WordPress Flash game theme.
Some features already developed:
* Highly customizable by setup page – no need to edit the code
* Ajax powered to browse it without reloading the header (the game itself)
* Minimal theme, a very few lines of code
Let me know what do you think about it. And don’t pay that much attention to contents… I just wrote a couple of lines just to make some tests
Loading WordPress posts with Ajax and jQuery
After seeing how to include jQuery Ajax calls in your WordPress blog, it’s time to load posts on the fly, without reloading the page.
As for the previous example I am using the standard Kubrick theme… without any plugin installed.
Look how I load the posts under the header by clicking on their titles… even the ones with “more” tag appear complete without reloading the page:
Let’s start with header.php modifications
This is the script I added under
< ?php wp_head(); ?>
That is the JQuery part Read more
Including jQuery Ajax calls in your WordPress blog
I want to show you how to include jQuery ajax calls in your WordPress blog.
The reason is simple: sometimes you may need to update the content of a WP page without reloading the entire page.
This is useful when you want the user to interact with your blog without forcing him to reload the page. Or when you want some events to happen “automatically” without user interaction.
In this video I am changing the header at every second without reloading the page.
Also notice I am doing it from the default Kubrick theme with a fresh installation… I am not using any jQuery powered theme or plugin. Let’s see how can you make it. Read more
My epic fail with ClickBank
Are you tired of reading about success stories with people making over $20K a day?
Here’s something new: did you notice, during this month, two ads about Farmville secrets and iPhone application development? Here they are:

These two ads belong to ClickBank, an ad network which at the moment made its clients earn more than a billion dollars.
As you can see in these two pictures, I did not earn a cent.


Let’s see what happened:
The reasons behind a failure
When I signed up at ClickBank, I obviously decided to display ads having something to do with my blog… this means programming, gaming or monetizing.
The most “interesting” products I was able to find were:
* A couple of registry cleaners (??)
* A couple of PS3 scam backup system (scam because you won’t be able to play with your backups)
* A dozen ebooks about the ULTIMATE (yeah) way to make money with a blog, or with ebay, or whatsoever
* Some hosting services
The first question was: did I really want my readers to buy a useless PS3 backup system? Come on…
So i opted for a FarmVille guide, even if I am not a FarmVille fan and I hate people posting on Facebook they just found a cripple blind sheep in their damned banana field. All in all FV is a great viral game and I thought a guide would be useful for some addicted players.
The other choice was a guide to iPhone programming… why not… I have a lot of programmers among blog readers.
Why it did not work
Well, every blog has its niche readers. Programmers are quite smart… unlike blogging mogul wannabes, they won’t buy anything from one-page websites claiming to sell the “Ultimate Guide to [put your favorite topic here, obviously all uppercase]”
People like you are looking for real deals from real companies, supported by real case studies… that’s why I was one of the three most important MochiAds referral while I wasn’t able to sell a single ClickBank guide.
So it was a waste of time. Wait. It wasn’t
Thanks to my experience, if you have a programming blog you can improve your ads revenue looking for products you can really review, test and suggest, leaving “ultimate guides” to newbies.
This obviously is my personal story, and results may vary according to the niche you’re talking at.
Triqui MochiAds Arcade plugin for WordPress upgraded to 1.2
Yesterday MochiMedia changed the games feed adding a new field called metascore that screwed the feed parsing.
So I am releasing the new version, compatible with the new feed and tested with WordPress 2.9.2. You can find it at the official page.
Talking about plugins, I am developing a new theme/plugin using crontables that automatically feeds the games, fixes the tables if MochiMedia updates the feed, and chooses the best games to publish.
Everything without any interaction from the user. The ultimate “forget about it and make money with your arcade site” plugin.
Stay tuned.
TUTORIAL SERIES:
- Una guida completa al gioco del poker online e una selezione dei migliori casino online.
- casino online
- migliori casino online
- BlackJack online
- casinò online


