Skip to content

10 Ways to Get That Elusive ‘Magazine’ Look in WordPress

WordPress ‘Magazine’ themes haven’t been around for long, but they’ve exploded in popularity. In this post we’ll look at ten ways to get that elusive ‘magazine’ look into your own WordPress theme.

mag

1. Dynamic sidebars

On just about every blog out there, the sidebar will remain the same on every single page you visit. With your magazine theme you obviously want to avoid the ‘hey, I’m a blog!’ look. The code below is adapted from the Mimbo theme.

So. Using simple if statements we can set content to display on posts, pages, whatever. In this example if the current page is a post then we’ll display other posts from the same category:

<?php
if ( is_single() ) :
global $post;
$categories = get_the_category();
foreach ($categories as $category) : $posts = get_posts('numberposts=5&exclude=' . $GLOBALS['current_id'] . '&category='. $category->term_id);
if(count($posts) > 1) 

{ ?> <div class="widget"> 

<h3>More posts in <?php echo $category->name; ?>

'</h3> <ul> <?php foreach($posts as $post) : ?> 

<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> 

<?php endforeach; ?> </ul> </div> <?php } ?> 

<?php endforeach; ?> <?php endif; ?>

2. Auto image resizing in posts

This is something that all the magazine themes do these days, but not without good reason; auto image resizing is super useful. There are a number of scripts that do the job, but my favourite is phpThumb

The example below is taken from an article I wrote on CatsWhoCode a while ago. Using phpThumb, it adds a shortcode that allows you to upload any old image and then resize it automatically to 590px (or whatever the width of your content area is). To use it, just put the url of the image between [img] and [/img] ie [img]/images/animage.jpg[/img]. Just put the code below into your functions.php file.

<?php function imageresizer( $atts, $content = null ) {
return ‘<img src=”/THEMEURL/phpthumb/phpThumb.php?src=’ . $content . ‘&w=590″
alt=””>’; }

add_shortcode(‘img’, ‘imageresizer’); ?>

The inevitable! The featured content gallery that is literally plastered everywhere! But hey, you can’t deny it looks quite nice. It’s super easy to use – a plugin of it is available at FeaturedContentGallery.com, or a tut showing you how to implement it directly into your theme is on CatsWhoCode.

4. An amazing options page

Something else that is a necessity these days is to have an awesome options page for your theme. Luckily creating on options page is something that we’ve just covered on [wp]! In part one we created the backend, and in part two we implemented it.

5. Tabbed sidebar

Tabbed content on your sidebar is very cool. Fact. Thankfully, they’re very easy to implement, as another post here on [wp] shows.

6. Display most viewed posts

This is something very magaziney (that is a word :P). Using Alex King’s Popularity Contest plugin, we can display the most viewed post, with the following code:

<?php if (function_exists('get_most_viewed')): ?>
<li>
<h3>Most Viewed</h3>
<ul>
<?php get_most_viewed('post', 5); ?>
</ul>
</li>
<?php endif; ?>

7. Display selected posts on the homepage without an extra category

Most magazine themes demand you create a category called ‘Featured’. We obviously don’t want to do this as it’s very annoying to have a category called ‘Featured’ left around when you switch themes. As Jean explains on WPRecipes, using custom fields, you can cleverly avoid the dreaded category and instead create a custom field called ‘Featured’, and for posts you want to be featured, just put a 1 as the value. Anyway, the world’s longest clause has now finished and I’ve had to put a full stop in. Do it with the following code:

<?php if (have_posts()) :
while (have_posts()) : the_post();
$customField = get_post_custom_values("img");
if ( (isset($customField[0])) && ($customField[0] == "myValue") ) {
//Custom field have myValue as a value, display info
the_title();
the_excerpt();
}
endwhile;
endif;
?>

8. Highlight current category

This is something else that is very magaziney. Highlighting the current category is very easy to do, as is done in the The Stars theme. Just create some styling for current-cat and you’re done.

<li class="<?php if (((is_home()) && !(is_paged())) or
(is_archive() && !(is_category())) or (is_single()) or (is_paged()) or (is_search()))
{ ?>current-cat<?php }
else { ?>cat-item<?php }
?>"><a href="<?php echo get_settings('home');
?>"><?php _e( 'Home', 'wpbx' ) ?></a></li>

9. Awesome breadcrumbs

Breadcrumbs are pretty much bog standard these days, but awesome breadcrumbs? Not likely. Thankfully, I wrote a tut on WPHacks a while ago explaining how to make Apple.com style breadcrumbs. Check it out and you too can have awesome breadcrumbs.

10. Change the default gravatar

Something I did when making my NomeBlog theme was change the default gravatar. Of course, it’s a magaziney thing to do. Thankfully it is quite easy too – just create a 100x100px image gravatar.gif and upload it to your theme’s directory. Then add the following code to your functions.php file:

<php if ( !function_exists('fb_addgravatar') ) {
function fb_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('template_directory').'/gravatar.gif';
//default avatar
$avatar_defaults[$myavatar] = 'Exciting new gravtar';

return $avatar_defaults;
}

add_filter( 'avatar_defaults', 'fb_addgravatar' );
}?>

Once you’re done, you can change the default gravatar in the backend under ‘Discussion’.

And that’s that

There we are. Wasn’t that fun! Anything you’d like to add? Leave a comment.

Yay! 🎉 You made it to the end of the article!
Alex Denning
Share:

11 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Add Your Own Gravatar To WordPress | WPShout.com
April 11, 2010 8:29 pm

[…] user doesn’t have a Gravatar then the following gets displayed:This tip applies especially to magazine themes, where the standard ‘bloggy look’ is something that designers try and get as far away […]

9 Ways to Create a Crash Proof WordPress Site | WPShout.com
November 29, 2009 5:25 pm

[…] images took the count down three queries so that’s something to bear in mind when creating a magazine theme.Custom loops are a massive culprit too with even the simple downloads section on WPShout using five […]

wordpress designer
July 3, 2009 5:36 pm

Great tips here that if followed can save you lots of stress and trouble. I wish i had read this post a while back, would def have saved me a lot of time now, i have to go fix my site 🙂

10 Ways to Get That Elusive ‘Magazine’ Look in WordPress | Nometech.com | Squico
June 14, 2009 7:20 pm

[…] In: WordPress themes 14 Jun 2009 Go to Source […]

tasarhane
June 14, 2009 7:19 pm

Finally i found it > Auto image resizing in posts
thanks 😉

» 10 Ways to Get That Elusive 'Magazine' Look in WordPress … Wordpress UK: Wordpress UK, taking it further…
June 10, 2009 10:54 pm

[…] Read the original post: 10 Ways to Get That Elusive 'Magazine' Look in WordPress … […]

WordPress & Blogging Articles for june 10 2009 | WPStart.org - WordPress themes, plugins and news
June 10, 2009 6:39 pm

[…] 10 Ways to Get That Elusive ‘Magazine’ Look in WordPress WordPress ‘Magazine’ themes haven’t been around for long, but they’ve exploded in popularity. In this post we’ll look at ten ways to get that elusive ‘magazine’ look into your own WordPress theme. – By Nometech […]

Display selected posts on the homepage without featured category | Plugins / Hacks | Totally WordPress
June 10, 2009 11:54 am

[…] Display selected posts on the homepage without featured category Submitted on June 10, 2009 – 13:53hr7 views | No Comments Yet… Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.From Alex Denning over at Nometech comes a great hack for magazine style themes with his post “10 Ways to Get That Elusive ‘Magazine’ Look in WordPress”. […]

LanceNelson
June 10, 2009 11:53 am

thanks Alex, what a useful post,

I still cant understand how to keep my comment box open. Do you have a v essy tutorial on that. I just cant see where to put the code?

thanks

Lance

Daily Links | AndySowards.com :: Professional Web Design, Development, Programming, Hacks, Downloads, Math and being a Web 2.0 Hipster?
June 10, 2009 1:01 am

[…] 10 Ways to Get That Elusive ‘Magazine’ Look in WordPress | Nometech.com freaking awesome tips for getting that 'magazine' look in WordPress (tags: wordpress theme magazine) […]

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!