WordPress for Beginners » Tutorials: How to Add an Author Info Box in WordPress Posts

March 15th, 2010

Many blogs have an author information box at the end of their posts. This is becoming one of the biggest trends in WordPress blogs. In this article we will show you, how you can add an author information box at the end of your single posts without a plugin.

Screenshot:

Author Info Box in WordPress Posts

First open your style.css file in your themes folder and add this code:

#authorarea{
background: #f0f0f0;
border: 1px solid #d2d2d2;
padding: 10px;
width:500px;
overflow:hidden;
color: #333;
}
#authorarea h3{
font-size: 18px;
color:#333;
margin:0;
padding:10px 10px 5px 10px;
}
#authorarea h3 a{
text-decoration:none;
color: #333;
font-weight: bold;
}
#authorarea img{
margin:0;
padding:10px;
float:left;
border: 1px solid #ddd;
width: 100px;
height: 100px;
}
#authorarea p{
color:#333;
margin:0;
padding:0px 10px 10px 10px;
}
#authorarea p a{
color:#333;
}
.authorinfo{
padding-left:120px;
}

Note: You might have to modify the CSS file to match your theme formatting.

Once you have added that then open your single.php and add this code inside your loop.

<div id="authorarea">
<?php if (function_exists('get_avatar')) { echo get_avatar( get_the_author_email(), '100' ); }?>
<div class="authorinfo">
<h3>About <?php the_author_posts_link(); ?></h3>
<p><?php the_author_description(); ?></p>
</div>
</div>

There are many ways to get the images for the author profile, but we used Globally recognized Avatars, Gravatar. This code will get the avatar associated with the author’s email.

If you have any questions, feel free to ask in the comments.

How to Add an Author Info Box in WordPress Posts is a post from: WPBeginner which is not allowed to be copied on other sites.

Related posts:

  1. How to Display an Author List with Avatars in WordPress Contributors Page
  2. How to Display Author’s Gravatar on their Individual Posts in WordPress
  3. How to Highlight Author’s Comments in WordPress


WP Engineer: WordPress 3.0 Menu Update

March 15th, 2010

The new menus WordPress 3.0 just got an update, provided by Ptah Dunbar. Thanks Ptah, cool work! I checked out the new version. But first a screenshot of the backend:

WordPress 3.0 Menu Option Page

As you can see, you can build your menu from modules. Right now these are pages, posts, custom links, categories, tags and media. You can sort the entries in your menu via drag & drop. Here an edit menu item screenshot:

Wordpress 3.0 edit menu item screenshot


Related posts:


WP Engineer Favicon Thanks for subscribing our feed! Sponsor the WP Engineer Blog and get your brand in front of several hundred users per day!
© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)


QuickOnlineTips: How to Make WordPress Faster and Safer

March 15th, 2010

Guest Post by Mark.
I admit, there are a lot of articles on the topic of promising you to share how to make WordPress faster and safer. Most of them under deliver. I’ll try my hardest not to make this article get into that category.

Before we start, I want to ask you: Have you ever heard about the 80/20 rule? This rule states that 80% of your results come from 20% of your efforts (80/20 is just a rule of thumb, it can be 90/10, 70/30 and so on.) My point is, the same principle applies for making Wordpress faster and safer. Spend several minutes, change some things, and reap big results. Those will be covered below.

How to Make WordPress Faster

When it comes to making Wordpress faster, 2 things matter most:
-  Hosting
-  Optimizing Wordpress

a) Hosting – How to Choose a great WordPress host

99.9% of webhosts support Wordpress. So, when it comes to the question ‘Which is the best Wordpress hosting solution’ you’re actually asking: ‘Which is the best hosting solution?’ Honestly, it’s very hard to give an answer to this question. The best answer would be, it depends (on your needs.)

There are some research sites like Netcraft that provide monthly reports on the most reliable hosting solutions. However, most of the hosts there, are for businesses and cost over $100 monthly. On the other hand, you can go with the most popular solutions (following the logic: if they’re popular and a brand, they must be at least above average.)

Another thing you definitely want to do before deciding to deal with a web host is to check out the business via BBB. In my experience, there seems to be a high correlation between the BBB rating for the company and the actual reliability that the company will offer.

To get to the point, which hosts do I recommend?

  • Hostgator.com (I personally use it for more than a year). HostGator are ThePlanet resellers (and ThePlanet is ranked as one of the most reliable hosts by NetCraft is some of their reports). Hostgator also has A+ BBB grade.
  • GoDaddy.com, has an A+ BBB grade and I heard very positive reviews from friends. They aren’t mentioned by Netcraft in many of their reports, though.
  • Hosting4less.com – I was surprised to see this company consistently ranking in the top 10 on Netcraft monthly reports, after investigating them I found they have an “A” grade from BBB and existing for quite a long time. So all data indicates they’re great.

Please be aware I haven’t mentioned many well-known hosts in this list. I was shocked to see that many of them (I don’t want to mention any names) aren’t even BBB accredited businesses!

b)  Optimizing WordPress

By optimizing Wordpress, I mean caching and compressing EVERYTHING (CSS files, the Wordpress database and so on.) Obviously, you want some automated solution to do all this for you.

Okay, so we need a caching plugin. Many people prefer WP-Super-Cache. However, my tests have shown very small or almost no significant improvement in performance when using this plugin. I just used this tool and measured my blog’s performance before and after I got the plugin enabled.

One plugin that improved my blog performance significantly was W3-Total-Cache (the creator is the Chief Technology Officer at Mashable.)

Proof: Here’s a screenshot of my blog speed without any caching plugin:

before caching

Now, here’s a screenshot with WP-Super-Cache enabled:

after super-cache

As you can see, this plugin not only didn’t improve my blog performance but also made it worse!

Now, let’s try WP-Total-Cache:

after total-cache

The speed improved by 300%! Why? Well, the author has a good explanation here.

Conclusion: WP-Super-Cache is way more popular than WP-Total-Cache. However, if something is popular it doesn’t have to mean it’s better than the less popular alternatives!

How to Make Wordpress Safer

Here’s a checklist of some of the basic things to make Wordpress secure:

  • Do you use the latest Wordpress version?
  • Is your computer clean of viruses and spyware? Key loggers can steal your username and password
  • Is you password strong enough? Do you have numbers and special characters?
  • Have you changed your default ‘admin’ username? See how.

Honestly, while researching, I found many posts on how to secure Wordpress but they all seemed to be repeating what is said in the Wordpress Codex on this topic. So go and read it, better do that than read hundreds of fancy posts on new techniques to secure Wordpress. Get the basics right before attempting something advanced.

In case you want maximum security, add a second layer of protection with AskApache Password Protect plugin. Warning: Test this plugin on a test blog first before attempting to use it on your main blog. And read the full warning in the codex above.

I don’t recommend you use this plugin unless your blog is extremely popular (gets 50k+ visitors per day.) Let’s be real here…most hackers attack the most popular blogs manually. Not many go after the less popular ones (they might use automated tools for the less popular ones but if you upgrade your installation regularly and use some basic plugins for protection like WP Security Scan, you’re safe.)

Also be sure to backup Wordpress. Oh, and forgot to tell you, that’s my site by the way. Feel free to subscribe if you want to. I hope you’ve learned a lot!

Mark is currently one of the authors for Mix The Net, a site for helping the casual surfer get more of the web. You can also write guest articles and share your WordPress tips and tricks.

  1. Use OpenDNS to Browse Faster, Safer, Fix DNS Errors
  2. Plugin Sandboxing in WordPress 2.2 : Safer Activation
  3. Upgrade Wordpress 2.1.3 Faster with Changed Files List
  4. Faster Multiple Wordpress Upgrades via Shell Access
  5. Make Your Site Faster with Google Page Speed, Firebug

Original article: How to Make WordPress Faster and Safer
Copyright 2010. Quick Online Tips. All Rights Reserved.

Twitter Facebook


scriptygoddess: Custom Template for Parent and Sub Categories (without a plugin) in WordPress

March 14th, 2010

When using WordPress as a CMS, I often repurpose the "posts" as other types of content a site may need. For example, news or press releases, or any information that might need the ability to be catgorized and/or tagged (like testimonials). However, this may mean that you need a completely different template for your news page than you would want for your testimonials page.

WordPress gives you the ability to create category specific templates. So let's say your "news" category has an ID of 5 – if you create a category.php page to be used by all the other categories, and also created a category-5.php page – then just your news page will use that template for the category archive page.

But – what if you have a huge handful of subcategories and you want them all to use the same category template as it's parent? (Let's also assume that we can't just make this the default template) Here's what I came up with. Let's say that Testimonials is our category – it has an id of 12. It also has a dozen or so subcategories (for argument's sake, lets say we've sorted our testimonials into groups from what types of companies these testimoinals have come from "Consulting Firms", "Web Host Providers", "Design Firms", etc.

We don't want to duplicate our category template for every subcategory we have. That's a nightmare to manage. So lets do this instead: In your category.php template file – before ANYTHING ELSE – even before you call get_header() – we add the following:

$thecategory = get_category($cat);
if ($thecategory->category_parent == '12' || $thecategory->cat_ID == '12') {
include(TEMPLATEPATH.'/testimonials-template.php');
} else {
/* include... default template file here like we included the "testimonials-template.php - or you can just wrap this around your actual template code... */
}

So what this does is it gets information about the category – if the current category's PARENT is 12 OR we are in fact looking at category 12 – then we pull in that special testimonials-template.php file… Otherwise the other code would be executed. (In the file I was using I just wrapped that around my existing category.php template code…

Please note: I have not tested this on if you have a SUB SUB category – I'm thinking $thecategory->category_parent probably only looks one level above the current category… so keep that in mind.

(I make the note above that this does not include a plugin because when I was trying to get this to work – one solution I had found online involved installing a plugin that kind of messed with my category heirarchy in a way I wasn't crazy about. Personally, I think this is a much simpler solution)

Related posts:

  1. Multiple Featured Content Galleries On a site I was working on recently, the client...
  2. Delink Pages Plugin (Plugin and this post last updated: 10/20/2009 – Latest Plugin...
  3. Conditionally change path to HTTPS One of my clients had set it up so that...

Related posts brought to you by Yet Another Related Posts Plugin.


WordPress.com News: Time to Spring Forward

March 14th, 2010

Ah, spring, when a young person’s fancy turns to … blogging. And time changes. (Maybe baseball too, if that’s your thing.)

WordPress.com blog time settings follow the UTC time standard. This method allows us to keep the stats database lean and fast. That translates into free stats for everyone!

UTC doesn’t change over the course of a year. Because of this, you’ll need to adjust your blog settings to account for Daylight Saving Time manually. If you live in the USA, today – Sunday, March 14 – is the day to spring forward and adjust your WordPress.com blog’s time one hour ahead.

Update: There’s a full listing of when Daylight Saving Time begins around the world in this article on Wikipedia.

To account for Daylight Saving Time, log in to your dashboard, click on Settings > General, and scroll to Timezone. Then change your timezone to one hour ahead of your actual time zone. If you have your timezone set to, for example, UTC-8 (PST), you’ll need to change it to UTC-7.

We’ll make another announcement before the “fall back” change, which is on November 7, 2010.



Sivel.net: Happy π Day

March 14th, 2010

I’ve gotten into this bad habit of not writing about anything except WordPress on this site. It’s quite sad in a way that I have this great publishing platform and I only write about WordPress, and I do so very little.

Many years ago, I don’t remember how many exactly, I was challenged by my High School math teacher, that if I could memorize all the digits of π that were on the poster (86) above the white board, that I would get an ‘A’ on the final without having to take it. I spent a week or two, I even wrote a program for the TI-83 to help me learn it. In the end I learned somewhere around 280 digits of π and got that ‘A’.

From then until now, I have always held a special place in my heart for this number of numbers. I own the movie π, I own the book a history of π and I have spent the last eleven to twelve years incredibly interested in this number. Back in 1998 or so I actually ran a site dedicated to π on geocities that is now long gone and forgotten.

So in keeping with the color scheme of that old site I used to run, which I now realize was very Matrix-esque, have a happy π day!

π

Happy π day!

PS: From my days as an astrophysics major, I was taught that really only the first 42 digits of π are useful for computational purposes. But what fun is that!? Keep learning and cranking out those digits of π!


WordPress.com News: OMG WordPress BBQ at SxSW

March 13th, 2010

OMG WordPress BBQ logoThis weekend, thousands of WordPress users and fans (including many hosted here on WordPress.com) are among the people attending the South by Southwest (SxSW) Interactive conference in Austin, TX. To celebrate this, we’re throwing a WordPress BBQ at SxSW tomorrow so that there’s a place for us all to get together.

If you’re a WordPress.com user attending SxSW (or you just happen to be in Austin), please join us for lunch after 12pm* tomorrow, Sunday March 14. Come, eat, meet some of the WordPress.com team, talk about the cool things you’re doing with WordPress on your site, let us know what we can do better, talk about some of the new features and themes you’ve been seeing here lately, etc. Think of it like a WordCamp without presentations. See how many WordPress.com staff you can spot chowing down on Matt’s favorite meal. :)

Location: Conjunctured coworking space, 1309 East 7th St., Austin, TX 78702. From the convention center, walk up to 7th Street, hang a right, and walk until you get to #1309. If you’re tired of walking, taking a cab is a decent option. Note that this is on the other side of I-35 from the convention center.


View Larger Map

* We’ll keep serving until we run out of food, so probably until around 2 or 3? We’ll have a hundred pounds of bbq meat, a bunch of sides, and dozens of gallons of iced tea, so come hungry.



aaron.jorb.in: More Twitter Shortcodes for WordPress

March 12th, 2010

Building on my WordPress Shortcode How To, here are two more Twitter shortcodes. I’ve also added a new project on google code to track all of my shortcodes.

The first new shortcode is for twitter search. It’s logically enough

 [twitter-search phrase='#haikufriday']

Like my last twitter shortcode, it caches the results for two minutes. It also includes some other options. You can specify the number of tweets using the number attribute. There is a default of 20. You can also specify a max and min tweet id using max_id and since_id . Finally, you can specify the language with the lang attribute. This defaults to English.

function jorbin_firestream_search($atts){
	extract(shortcode_atts(array(
	'phrase' =&gt; false,
	'lang' =&gt; 'en',
	'max_id' =&gt; false,
	'since_id' =&gt; false,
	'number' =&gt; '20'
	), $atts));
	if ('phrase' == false){
		return false;
	}
	//*/ Build our search url and transient name
	$transient = 'tweet-'. esc_sql($phrase) . '&amp;l=' . esc_sql($lang);
	$url = 'http://search.twitter.com/search.json?q='. urlencode($phrase) . '&amp;show_user=true〈='. urlencode($lang) .'&amp;rpp=' . $number;
 
	if ($max_id != false){
		$url .= '&amp;max_id=' . (int) $max_id;
		$transient .= '&amp;m=' . (int) $max_id;
	}
	if ($since_id != false){
		$url .= '&amp;since_id=' . (int) $since_id;
		$transient .= '&amp;s=' . (int) $since_id;
	}
	var_dump($transient);
 
	if ( $tweet_display = get_transient($transient) ){
		// It's allready been brought
	}
	else {
 
		$search = wp_remote_get( $url );
		$results = json_decode($search['body']);
 
		ob_start();
			$tweets = $results-&gt;results;
			 //*/
			foreach ( (array) $tweets as $tweet){
				$tweetcontent = $tweet-&gt;text;
				$newcontent = preg_replace('%@([^\s]*)%', "<a href="http://twitter.com/\\1">@\\1</a>", $tweetcontent);
				echo "
<div class="twitter_shortcode">
 
				<img class="twitter_shortcode_image" src="&quot;.esc_url($tweet-&gt;profile_image_url).&quot;" alt="" /><span class="twitter_shotcode_username"><a href="http://twitter.com/&quot;.$tweet-&gt;from_user.&quot;">".$tweet-&gt;from_user."</a> — </span>$newcontent</div>
";
 
			}
		$tweet_display = ob_get_clean();
		set_transient($transient, $tweet_display, 120);
		}
	return $tweet_display;
}
 
add_shortcode('twitter-search', 'jorbin_firestream_search');

Like before, there are some classes for you to work with that should make it easy for you to theme these shortcodes. If you want for me to add more, comment below.

The second shortcode allows you to get and display a list of the most recent trends on twitter using the shortcode:

[twitter-trends]

This one doesn’t have any attribute. The output is in an unordered list with the class of twitter-trends.

function jorbin_twitter_trends(){
 
	$transient='twitter-trends';
	$url = 'http://search.twitter.com/trends.json';
 
	if ( $tweet_display = get_transient($transient) ){
 
	}
	else{
		$search = wp_remote_get( $url );
 
		$results = json_decode($search['body']);
		$trends = $results-&gt;trends;
		ob_start();
			echo "
<ul class="twitter-trends">";
			foreach ($trends as $trend){
				echo '
	<li><a href="' . esc_url($trend-&gt;url) . '"> '. esc_html($trend-&gt;name) . '</a></li>
';
			}
			echo "</ul>
";
		$tweet_display = ob_get_clean();
		set_transient($transient, $tweet_display, 120);
	}
	return $tweet_display;
}
 
add_shortcode('twitter-trends', 'jorbin_twitter_trends');

If you use any of these, let me know. If there are any improvements or more you want to see, comment below.


Il Filosofo: New WordPress Plugin: Custom Image Sizes

March 11th, 2010

I make a lot of WordPress themes, and frequently clients want to associate a particular size of image with a post. You can do this easily with WordPress by using add_image_size() to define an image and then by calling wp_get_attachment_image() later to print the markup for that image.

So for example, if I have an attachment image of ID number 123, I might do something like the following:


add_image_size( 'my-custom-size', 220, 180, true );
...
echo wp_get_attachment_image( 123, 'my-custom-size' );

Here, add_image_size() defines the custom thumbnail (in this example the arguments tell add_image_size() to make it 220 pixels wide, 180 high, and cropped), and

echo wp_get_attachment_image()

prints the markup of the image itself, <img> element and everything.

The Problem

This works great; WordPress even creates thumbnails in this size from now on. The problem is that it doesn’t apply to pre-existing thumbnails. And if people change their minds about what sizes they want their thumbnails to be (clients sometimes change their minds) you’re stuck with existing thumbnails of the wrong size.

In addition, if you call wp_get_attachment_image( 123, 'my-custom-size' ); and that size doesn’t exist, WordPress just scales down the larger-sized original image, which might cause some performance issues.

Solution: Custom Image Sizes

My solution is the Custom Image Sizes plugin. You activate it, and if you call wp_get_attachment_image() and related functions for an attachment that doesn’t have that size, WordPress will create it on demand.

As a bonus, if you pass a width and height of the desired image to wp_get_attachment_image() (and related functions), you can create any size image. So for example I could create a thumbnail 50 pixels wide by 40 high of attachment 123 with the following code, where '50x40' is '[width]x[height]':


echo wp_get_attachment_image( 123, '50x40' );

Download

You can download the Custom Image Sizes plugin here.


WordPress TavernWordPress-org: WordPress Dev Chat For 3-11-10

March 11th, 2010

wordpresslogoStatus check up first
The UI group is tackling a few design things while Jane is performing some testing at South By South West. After the testing is completed, all lingering UI will be done for WordPress 3.0. Ryan Boren stated that themes needed to be finished in the GUI, land the big menu patch and tidy off custom background and header stuff. The UI group will soon have comps on the background/header stuff. Ptah Dunbar has been doing a good job tackling the menu items and they are almost there.

Mark Jaquith will try to sneak in additional post thumbnail support for WordPress 3.0.

Tickets That Were Discussed In Depth
The next part of the meeting focused on specific tickets that were brought up for discussion. I’m just going to link to the tickets and let you read the log file for in depth discussion on these items.

wpmuguru: http://core.trac.wordpress.org/ticket/12357 high, blocker, 3.0, nacin->nbachiyski, new, Strings we need to hard code and WP_I18N prefix

miqrogroove: http://core.trac.wordpress.org/ticket/9591 high, normal, 3.0, Denis-de-Bernardy->ryan, reopened, sanitize_title_with_dashes() and remove_accents() improvements for i18n permalinks

westi: http://core.trac.wordpress.org/ticket/4739 high, major, future, einare->westi, closed, Some icelandic/Norwegian/Danish letters do not work in page slugs

miqrogroove: http://core.trac.wordpress.org/ticket/10041 high, normal, 3.0, miau_jp->Unassigned, reopened, like_escape() should escape backslashes too

miqrogroove: http://core.trac.wordpress.org/ticket/10607 normal, normal, 3.0, UnderWordPressure->westi, reopened, return variable $new_array in wp-includes/wp-db.php is not initialized

miqrogroove: http://core.trac.wordpress.org/ticket/11711 normal, normal, 3.0, miqrogroove->ryan, new, tag_id Doesn’t Work in WP_Query

miqrogroove: http://core.trac.wordpress.org/ticket/11845 normal, normal, 3.0, miqrogroove->Unassigned, new, mod_rewrite Should Not Be Used to Check Existence of index.php

miqrogroove: http://core.trac.wordpress.org/ticket/12136 normal, normal, 3.0, nacin->wpmuguru, reopened, Improve MS rewrite rules

nacin: http://core.trac.wordpress.org/ticket/12416 high, blocker, 3.0, Denis-de-Bernardy->ryan, new, “*_option(), *_transient() and *_meta() functions should all expect unslashed data.”

I also asked about the email that will be sent out to plugin authors in order to get a heads up on the changes which may effect compatibility. The email will be sent out before the release of WordPress 3.0 but the text of that email will also be announced on the WordPress developer blog.

To read the log file associated with this meeting, click here and scroll up.

How To Participate:

If you want to suggest a development oriented topic to be discussed at the next meeting, you can by visiting the WordPress development updates blog. If you would like to participate in the chat next week, install IRC or an IRC compatible client and connect to the following IRC server.

chat.freenode.net or any random server on the Freenode network and then join this channel at 3:30PM Eastern time or 20:30 UTC Thursdays. #wordpress-dev.

Related posts:

  1. WordPress Dev Chat For 2-18-10
  2. WordPress Dev Chat For 2-04-10
  3. WordPress Dev Chat For 10-22-09


aaron.jorb.in: Portland WordPress User Group Presentation Upcoming

March 10th, 2010

I’m going to be speaking at the March Portland WordPress User Group Meeting on March 18th at 6:00pm at Webtrends and demonstrating some of the features that are coming up in 3.0. I’m aiming for this to be beneficial for both users and developers.

Right now, I plan on covering:

  • What the Multisite features mean to both users and developers
  • How to enable Multisite once you’ve upgraded
  • How to add and customize custom menus on your site
  • How to add a custom post type

If there is anything else that you would like for me to cover, please comment on the post there. I hope to see you there!


WordPress Community Podcast: BuddyPress Social Networking

March 9th, 2010

This weeks guest was Andy Peatling of the BuddyPress.org Project. BuddyPress is a social networking plugin for WordPress which ads many of the features found on sites like Facebook to WordPress blogs in as few as 10 minutes. We discussed how BuddyPress came about, some of the ways its used, some tips on getting started, customizing it and most importantly the features it provides. In news, there were a few nice plugin releases/updates and as always quick update on the WordCamp schedule.


W-Shadow.com: Showing Different Ads To Different Visitors

March 9th, 2010

Just today, I decided to run an impromptu experiment to test if visitors who come from search engines are really more likely to click on ads. It’s considered  ”common knowledge” by many bloggers who advise everyone to only show ads to search engine visitors (as a quick Google search will illustrate), but my own AdSense stats made me doubt that particular piece of advice. Hence the experiment.

So how does one show different ads to different visitors? Normally you could use the excellent Who Sees Ads plugin, but that doesn’t work for my site. I’m using the WP-SuperCache caching plugin which is incompatible with Who Sees Ads.

Instead, I wrote a JavaScript function that can analyse the HTTP referrer to distinguish between four types of visitors :

  • People who accessed your page directly, e.g. by typing in the URL (no referrer).
  • People who clicked an internal link to access the page (referrer from the same domain).
  • Search engine visitors; people who arrived via Google or Yahoo! (referrer matches one of the most popular search engines).
  • External visitors. This is basically a catch-all category for everyone who found your link on a third-party site that’s not a search engine. For example, this would include external forums and web directories.

Here’s the script :

function get_referrer_type(){
	var ref = document.referrer;
 
	if ( ref.length == 0 ){
		return 'none';
	}
 
	function getHostname(str) {
		var re = /^(?:f|ht)tp(?:s)?\:\/\/([^\/]+)/im;
		var matches = str.match( re );
		if ( matches ){
			return matches[1].toString();
		}
		return '';
	}
	if ( getHostname(ref) == document.location.host ){
		return 'internal';
	}
 
	var SE = ['/search?', '.google.', 'web.info.com', 'search.', 
		'del.icio.us/search', 'soso.com', '/search/', '.yahoo.',
		'.ask.'];
	for ( var source in SE){
		if (ref.indexOf(SE[source]) !=-1) {
			return 'search';
		}
	}
 
	return 'external';
}

The function get_referrer_type() returns one of “none”, “internal”, “search” or “external” based on the referrer info.

And here’s the script that I used to show different  AdSense ads to different people :

function get_top_adsense_ad(){
	var default_slot = '1111111111';
	var code = '<'+'script type="text/javascript"><!--\ngoogle_ad_client = "pub-0000000000000000";google_ad_slot = "%ad_slot%";google_ad_width = 336;google_ad_height = 280;\n//--><'+'/script><'+'script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></'+'script>';
	var slots = {
		'none' : '2222222222',
		'internal' : '3333333333',
		'external' : '4444444444',
		'search' : '5555555555',
	};
 
	var ref_type = get_referrer_type();
	if ( typeof(slots[ref_type]) != 'undefined' ){
		code = code.replace('%ad_slot%', slots[ref_type]);
	} else {
		code = code.replace('%ad_slot%', default_slot);
	}
 
	return code;
}
 
document.write(get_top_adsense_ad());

Unlike get_referrer_type(), this script is optimized for my site/AdSense account. Don’t try using it without modification ;) If you want to use it, replace “pub-XXXXXXXX”, the ad slot IDs and ad width/height settings with your own values (you can find them in your AdSense ad code).

As for the experiment, I’ll post the results sometime next week.


Copyright © 2010 W-Shadow.com. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@w-shadow.com so we can take legal action immediately.

WordPress.com News: New Theme: Titan

March 9th, 2010

Titan is a fantastic theme, now available on WordPress.com. It’s a highly readable, clean theme, with lots of options: four widget areas, a customizable header, and more.

Behold Titan!

An enticing color scheme and loads of customization make Titan a wonderful theme for you blog. To start things off the header has some nice social networking and RSS links, making it easy for users to keep up with your blog.

Right below the title is a highly customizable header. There are options to turn on and off categories and pages, allowing you to choose how users navigate your blog.

Titan's Header Options

Aiding in even more customization are four widget areas, including a nice footer widget area.

Titan's Footer Widget Area

Titan was designed by Drew Strojny and is available in the WordPress.org Themes Directory. You can check out Titan for yourself at http://titandemo.wordpress.com



Viper007Bond.com: Automattic

March 8th, 2010

As of today, I am officially a fulltime Automattic employee! I’ve been contracting with Automattic for a few months now but didn’t want to talk about it for fear of cursing it. It really is a dream job for me as I’m working with some of the best people in the business and the WordPress community and I couldn’t be happier. I want to thank Matt and everyone else at Automattic for giving me this great opportunity.

Automatticians In Quebec, October 2009

(I’m 4th from the right in the back row.)

No related posts.


WordPress TavernWordPress-org: WordPress GSoC 2010 Program Under Way

March 7th, 2010

The 2010 Google Summer Of Code program for WordPress is just about ready for prime time. The Google Summer of Code is a global program that offers student developers stipends to write code for various open source software projects. It was created in 2005 and continues to this day. Thanks to some willing students in 2009, we saw the creation of a new search API, and a theme framework in Elastic. When comparing the projects list from 2010 to 2009, they haven’t changed much although bbPress has been added to the list this year.

One of the project ideas that caught my eye was Template Versioning.

WordPress saves post revisions, but changes to theme files are not recorded, though the presentation layer is sometimes just as important. Build a versioning system for template files within the theme editor.

I wonder if any willing student will snatch up this project. This project idea also confirms that the built in theme editor isn’t going anywhere anytime soon.

For any students who want to participate in the WordPress GSoC project, you’re encouraged to review the application template from 2008 as well as the ideas from last year. However, the best way to increase your chances of being selected is to start learning the WordPress code base right now and submit a few patches so the mentors can get a basic idea of your abilities.

Good luck to any student who pursues one of the listed project ideas.

Related posts:

  1. It’s That Time Of Year Again
  2. A Theme Called 2010
  3. WPTavern in 2010


YoastArchives - Yoast - Tweaking Websites: WordCamp Ireland: having a blast!

March 7th, 2010

So I'm in Kilkenny, Ireland for WordCamp Ireland, and I'm having a complete blast, thanks in large part to the great organization done by Sabrina Dent and Katherine Nolan. The tech track is absolutely blowing my mind: it's really techy!

The people here are great: I met a lot of awesome people, basically to be separated in two groups. Group one are the Automattic people: Donncha, Jane Wells, Sheri Bigelow, Hanni RossJohn Godley. Some of the other people worth mentioning because they did cool stuff: Daryl Koopersmith gave a great talk on WordPress themes, Andrea Trasatti did another superb presentation on WordPress mobile plugins and themes (and got me to actually work on yoast.com and get me a decent mobile plugin going). Thank you, all!

Lastly, I'm always amazed that even though I mostly live in a Google world (actually, I had lunch with Fili Wiese and colleagues in Google's EMEA HQ last friday and Luisella Mazza from Google is here on WordCamp Ireland too), the people from Microsoft I meet on these conferences almost always turn out to be absolutely awesome people: Josh Holmes and Martha Rotter: you rock!

So I gave a presentation myself on saturday, which has been filmed and will probably appear on WordPress.tv, but these are the slides:

WordCamp Ireland: having a blast! is a post from Joost de Valk's Yoast - Tweaking Websites.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on WordPress hosting!


Holy Shmoly!: First Day at #WCIRL

March 6th, 2010

So, day one of WordCamp Ireland draws to a close, there is a dinner tonight but the talks and sessions are over for the day.

I briefly helped John Handelaar during his talk on WordPress MU, but my main talk was on WP Super Cache. Thank you Hanni, Jane and Sheri for recording the talk. Hopefully it’ll be available online next week. In the meantime here’s the OpenOffice slides of my talk.

I must extend a big thank you to Sabrina Dent and Katherine Nolan for organising a great day and to the sponsors who made the weekend possible.

Looking forward to the dinner tonight, and the rest of the conference tomorrow.

Update! I’ve added a few photos from Day 2. I was shattered tired though as I was up until 1.30am chatting with Donnacha!

Update 2! Sabrina has written a thoughtful post about WordCamp Ireland. I for one had a great time there and so did everyone I spoke to. I totally agree with her about child minding facilities. My son Adam had a whale of a time, and is still talking about it. (and for an almost three year old, that’s a very good sign!)

Oh, more photos on Pix.ie!

Related Posts

  • No related posts


scribu: Smarter Navigation: Version 1.2

March 6th, 2010

This version requires PHP 5. If you’re getting an error on activation, it means you’re running PHP 4.

Two template tags have been added:

If you have posts in multiple categories, you can use get_referrer_category() to retrieve the category object, based on the referrer url.

get_referrer_url() returns the full URL of the referrer.

Also, there are two extra arguments for previous_post_smart() and next_post_smart(): $in_same_cat and $excluded_categories.

This is how the function prototype looks like:

previous_post_smart(
	$format = '&laquo; %link',
	$title = '%title',
	$fallback = true,
	$in_same_cat = false,
	$excluded_categories = ''
);

WordCast: Commit: The Story of Writing a WordPress Patch | aaron.jorb.in

March 6th, 2010

boot stepping on WordPressRecently, Aaron Jorb wrote “Commit: The Story of Writing a WordPress Patch” about a the process of submitted code to the core development of WordPress.

Hanging out in the #WordPress irc channel or on the wp-hackers mailing list, a question that comes up from time to time is “How do I get a bug patched”. I recently had a patch committed, so I thought I would detail the process from start to finish to help others get an idea of the process…

The process for me started by seeing a post by Jane Wells talking about a few UX enhancements she wanted to see handled during the recent patch sprint. One that I noticed hadn’t received any attention was showing the status of an admin attempts an e-mail change under the new multisite configuration. I took a quick look at the relevent code and figured this was something I could patch.

The step-by-step documented process shows a three to four step process from idea and submission to final approval, however it also proves how easy it is to get involved and help WordPress improve.

According to Aaron, it took four people along the way to make this happen, dispelling the confusion and complexity many presume about the WordPress development process.

The development team is working hard to improve the process and make it easier for people to not just report bugs but to see their fix through to the end, so why not jump in and help WordPress grow.

Related Articles on WordCast:


WordCast: WordCast Recap: 3/1/10

March 5th, 2010

It’s Friday once again! The WordCast network has been bringing you the best WordPress, blogging and social media news, tips, tricks, reviews and how-tos all week long, and we’re bringing the best of the best to you. From some important security details to the THEME TEAM!, look no further for the complete wrap-up of this week in blogging, WordPress and social media.

February 1 – 5, 2010

WordPress Hack Cloakes Itself to All But Search Engines

Automattic Hires Theme Developer Ian Stewart, Forms “Theme Team”

Donate to Your Favorite WordPress Project: Support a WordPress Developer Day

Learn to Write WordPress Plugins in 20 Minutes (video)

Around the WordPress Community: Dynamic Copyrights, Moving WordPress, Microformats, and Twitter to Blog

WordCast Conversations 7: WordPress and Blogging for Musicians and Bands

Our newest show, Plugin Picks premiered this week with Plugin Picks 1: Audio Player and Plugin Picks 2: Google Analyticator

Got comments, questions, ideas or suggestions? We live off your feedback. Call us up at 1-888-525-BLOG or send an email over to mail@wordcastnet.com. You can also chime in on our Twitter, @WordCast, or in the WordCast Forums.

Have a great weekend, and we’ll see you on Monday!

Related Articles on WordCast:


WordCast: WordPress Hack Cloakes Itself to All But Search Engines

March 5th, 2010

ThemeLab is reporting that a new WordPress hack is making the rounds, potentially to your own blog. Like most security breaches, the worm links to all sorts of spam sites from your blog. However, what makes this little guy unique is the fact that he only shows himself to Google IP addresses.

Also unique to this attack is the fact that it seems to only be targeting blogs hosted on MediaTemple servers. The popular hosting company published a page on the issue on Tuesday, and have since updated it stating that all malicious content has been removed.

However, some bloggers have still found some rogue files, and it can’t hurt to check your self-hosted WordPress blog, just to make sure you’re clean.

According to ThemeLab’s blog post, MediaTemple’s page and a forum post from our friends at WPTavern, here’s what we know at this point:

  1. Affected servers will often have PHP files with random names (examples given in the MediaTemple post include xkehy.php and xfami.php) in the document root (the HTML directory). These files can be removed with no detriment to your blog. Some say that some files designed to look like WordPress core files could be hiding in various folders as well.
  2. Altered pages are only visible to spiders used by search engines such as Google, Bing and Yahoo.
  3. If people visit the links themselves from other (non search engine) IP addresses, they are redirected to a CNN RSS Feed.
  4. If you click through to any URLs from a search engine, you are sent to a malware site.

If you have any further information about this WordPress hack, please post a comment below or join the discussion in the WordCast Forums.

Related Articles on WordCast:


WordCast: Automattic Hires Theme Developer Ian Stewart, Forms “Theme Team”

March 5th, 2010

Yesterday, highly respected WordPress theme developer Ian Stewart announced on his personal blog that he has been hired by Automattic as a Theme Wrangler.

Ian informed readers that his once premium-only themes are now available for free (possibly due to employment agreements with the company):

He then dropped the information that will be most intriguing to members of the WordPress and blogging community: his blog, ThemeShaper, is also joining Automattic, as a front-end to what he calls a “theme team” being formed at the company.

ThemeShaper will become a public-facing blog for the Theme Team now assembling at Automattic. A place where we can help provide the best possible experience for everyone involved in WordPress theming; from the noobiest of beginners to the most powerful of WordPress wizards.

Because the founder of the WordPress project, Matt Mullenweg, is also the founder of Automattic, the company has always had a fair amount of influence on the WordPress community. However, up until this point, its’ role in the development and extensibility area of WordPress has always been extremely limited. How much will the new ThemeShaper shape the world of WordPress themes?

Ian’s description of the new blog and team in his post is fairly ambiguous. The Theme Team could be a support team, a community dedicated to helping theme developers innovate. Perhaps they will work on innovations in WordPress themes, developing components and coding features for other theme developers to use, or perhaps they’ll even be working on themes of their own.

What are your hopes for Automattic’s new foray into themes? Is it worthwhile, a waste of time, or could you care less? Post a comment below or join the discussion in the WordCast Forums.

Related Articles on WordCast:


BloggingPro Plugins: WordPress Plugin Recommendation: Zen, Distraction Free Writing Environment

March 5th, 2010

One of the both better and more annoying factors of WordPress is the huge amount of core features. Of course it is great to work with a platform which makes almost everything possible but this can also take away from your focus.

I am a big fan of taking out clutter, focusing on what really matters and love to simplify both life and working environment. The WordPress dashboard is well thought out, and popular, but I am the first one to launch an external writing application such as OmmWriter or WriteRoom, helping me focus just on content, especially when writing longer entries. For many smaller projects I am involved in, I prefer ’simpler’ platforms than WordPress, platforms focusing more on blogging rather than on being the awesomest, most complete or extendable platform.

Enter Zen, a distraction free writing environment for WordPress by Mohammad Jangda.

If you’re a fan of ‘anti-clutter’ plugins such as simple email notifications, you’ll love Zen for WordPress. More even, if you would have been on the verge of switching to a more writing focused platform such as Habari but on could not decide to ditch WP yet, Zen might be what you are looking for.

If you’re a fan of WriteRoom, OmmWriter, or similar tools that help you focus on your words instead of the tools you’re using, this plugin will soon make your wildest dreams come true (and give you a simple clean environment within WordPress to write to your heart’s content)! While Zen does not replace the existing Edit Post/Page screen, it provides a layer on top that will help you focus more on the quality of your words and less on the distracting fine-tuning of minuscule details.

Zen does not replace your editor or change the look of your dashboard but in the post editor you now can activate Zen with one click and call up the new layer. You can even set ‘Always write in Zen mode’ as standard (in Your Profile).

Zen comes with several themes (which can be selected in Your Profile) making Zen a little more noisy again but you don’t have to use these.

All in all Zen’s a nice and agreeable addition to WordPress and a new recommended plugin for me. Download Zen from the plugins directory or install it within WordPress (search the plugins repo for Zen).


WordCast: Do We Really Know What the Future of Blogging Will Be?

March 4th, 2010

blogging-in-eye representing the futureWebWorkerDaily wrote an editorial, “The Future of Blogging” which stats that the recent Pew Research on the future of blogging on the younger generation implies that there is too much on the web that it dull and boring, and people are losing interest in the same old same old blogs.

A recent Pew survey revealed that the popularity of blogging among teens and young adults has declined dramatically from 28 percent to 14 percent from 2006 to 2009. While this wasn’t an exhaustive scientific study, it does reveal a trend that clearly shows that blogging is losing its luster with today’s younger generation. There are many factors that could have contributed to this drastic decline, such as the plethora of real-time communication platforms like social networks, the explosion of gaming platforms (Wii, Playstation, Xbox) and 24/7 access to instant entertainment such as Netflix and Hulu. Regardless of the reasons, the bottom line is that young people are getting bored of traditional blogging.

The editorial goes on to blame much of it on dull and boring web designs and the “shrinking down” of the web to smaller and smaller mobile devices. Research reports like this challenge those of us in the blogging industry to re-examine where we’ve been and where we are going to go, and which changes to embrace and which to shove aside.

The traditional media is moving quickly now into the blogging industry, leaving print and television practices behind, shrinking down reporting and film crews to those good with hand cams and ear mics, and moving their news and editorials out into the virtual world. For those who have been in the virtual publishing industry for years, big media is now our competition. Are we up for the fight? Can we hold out against their onslaught?

Blogging began as online diaries and moved slowly into the professional world. The social web created by these revealing “transparent” blogs embraced faster methods of sharing content and thoughts with the development of social media tools to amp up the social interchange through various networks like Digg, Twitter, StumbleUpon, Technorati, and other peer-to-peer driven “sharing” sites. The blog didn’t die, it just got busier, and so did the bloggers as they spread their ideas beyond their blogs.

What’s the next step? What is the future of blogging? Have you been watching the trends? Where is blogging going?

Related Articles on WordCast: