WordPress plugins, themes, tips and hacks

Archive for the ‘WordPress as CMS’ Category

How to rename widgetized sidebars in Wordpress

Thursday, November 20th, 2008

You can manage multiple sidebar widgets in WordPress. To do so, you go to the Widgets page in the Admin, and select the Sidebar you want to manage. If you have 1 widgetized sidebar, the name “Sidebar 1″ is not a big deal for managing it. But what if you have 5 or more, and they’re named Sidebar 1, Sidebar 2, etc. Ah yes, now what was that wily sidebar 3 for?

Why would someone have so many sidebars to begin with? Well, remember that you can also add widget-ready sidebars to Wordpress footers or anywhere in your design, to give extra content management options to clients.

Recently, we had a client with way too many widgetized sidebars to keep track of, so we had to find a new solution to change the standard widget sidebar names like “sidebar 1″ or “sidebar 2″ to something more meaningful like “Left sidebar” and “Right sidebar” in the admin area. I dug around the web and found 2 very helpful posts:

Here’s what I learned:

1. Go into your themes’s function.php file, or if it doesn’t exist, create it.

Add the following code:

<?php

if (function_exists(’register_sidebar’))

{

register_sidebar(array(

‘before_widget’ => ‘<li>’,

‘after_widget’ => ‘</li>’,

‘before_title’ => ‘<h4>’,

‘after_title’ => ‘</h4>’,

‘name’ => ‘Left sidebar’

));

register_sidebar(array(

‘before_widget’ => ‘<li>’,

‘after_widget’ => ‘</li>’,

‘before_title’ => ‘<h4>’,

‘after_title’ => ‘</h4>’,

‘name’ => ‘Right sidebar’

));

}

?>

2a. Add a widgetized sidebar to your theme. Open up your theme’s sidebar file (for exampe, l_sidebar.php) and look for the first <ul> or <ul id=”sidebar”> or something similar, and add the following code:

<?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar(’Left sidebar’) ) : ?>

2b. If your sidebar is already widgetized, find the following code

<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar(1) ) : else : ?>

and replace it with

<?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar(’Left sidebar’) ) : ?>

Then, find the closing </ul> at the very bottom of the file, and immediately before that, place

<?php endif; ?>

3. Now, if you go into your admin panel, under Design>Widgets, you’ll see the new names like in the image below.

Now you can easily manage your Widgets without trying to guess which one is which.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

13 plugins that will make WordPress into a CMS

Monday, January 14th, 2008

Recently I posted about why I think WordPress is a CMS. This led to a pretty interesting discussion in the comments on the topic, but it was unresolved.

Here’s some more fuel for the fire: I just came across Josh Byers’ blog, thanks to his amazing Custom Admin Branding Plugin. He has a post there that lists the plugins he uses to transform WordPress into a full-fledged content management system (CMS). Aside from the fact that it’s good to know about the plugins he mentions, it’s interesting to note that by adding a few plugins, Josh feels that his WordPress sites can be considered CMSs, as opposed to just blogs.

Here are some of the plugins that he says he uses to make WordPress into a CMS. Visit his blog to see the rest of them, and read his concise descriptions of each one, and why he uses them:

Here are a few more tweaks and plugins that I think help make WordPress into a great CMS:

  • The WordPress static home page option – obviously. The fact that the home page of your blog can be a static Page by selecting a single option in the admin changes WordPress from a blog into a CMS. I don’t know why people always ignore this.
  • Page Links To Plugin: gives more flexibility to WordPress Pages by allowing you to link them to other pages, like category pages.
  • Role Manager Plugin: better and more precise role management in WordPress
  • Future Posts Calendar Plugin: this plugin is a savior. It gives me an overview of the days when posts are scheduled to be published, so I can make sure that posts are spread out evenly across the week, instead of all of them ending up on Tuesday (for example).
  • Admin Drop-down Menus Plugin: also a life saver (not the candy). Can you imagine getting to the Write Post page with just one click, instead of clicking on Manage, waiting, and then clicking on Post? Will, this plugin turns everything into drop-down menus, so submenus are just one click away.
  • All in One SEO pack, Google Sitemaps Generator Plugin and Meta Robots WordPress plugin: just upload and activate these WordPress plugins, and you’ll have a serious SEO advantage over so many other sites.

I think that the whole argument over whether WordPress is a CMS boils down to the lack of an exact definition of what a CMS is. So, according to my definition of a CMS, which holds no weight whatsoever, WordPress meets the criteria.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

ZDNet says WordPress not clunky, but also not CMS

Friday, December 21st, 2007

Larry Dignan over at ZDNet writes about the media’s relationship with CMS systems, particularly his own past experiences with custom-built CMS systems. He says that “when it comes to ease of use, a blog platform beats or [sic] average CMS hands down.” So he asks why it is that he’s always getting stuck with some clunky, Frankenstein-like CMS system when he could happily and easily use something like WordPress. And he basically asks if people in the media industry will ever figure out that they don’t have to reinvent the wheel, since it already exists.

But what struck me the most about this article was the Update at the end, where he says that he was corrected by Dennis Howlett, who pointed out that WordPress isn’t actually a CMS.

This is something that I really don’t get. WordPress manages content, does it not? Then why isn’t it a CMS? How come I can call the awful, clunky systems that I used before WordPress CMS systems, even though they don’t have even half of the functionality and features of WordPress.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

WordPress challenge: getting class current_page_item to work when home page is not blog

Wednesday, December 5th, 2007

Sorry for the confusing title, but there is an issue that we face over and over when using WordPress as a CMS, and have not been able to solve. When we are using WordPress as a CMS, our Blog page doesn’t pick up the current_page_item class and therefore its link on the nav bar isn’t highlighted like the other pages are. How can we get it to change?

I know that the above might not make sense, so here is a detailed description of the problem:

If you use WordPress as a CMS, you generally create the Pages you want to appear on your nav bar under Write > Write Page. One of those Pages is the Home page, for example, and you create another Page for your blog posts called Blog. Then, you go to Options > Reading, and select one of those pages for your front page from the drop-down list, in this case you would select the Home page, and another page for your blog posts, in this case the Blog page.

options-read1.png

You create a style in your style sheet called current_page_item which causes the current page that the viewer is on to appear differently in the nav bar or list of pages. For example, you want the background color of that page on the nav bar to change from green to purple.

Now, here’s where the problem lies: all pages on the nav bar change from green to purple when the user is on that page…except the Blog page! For some reason, that Blog page does not pick up the current_page_item class.

So my question is: does anyone know of a solution to this problem?

Thanks!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Display posts from specific categories on a Page

Thursday, November 8th, 2007

You may want to display posts from a specific category on the homepage or other pages of your site. For example, you might want to have a box that displays the latest three posts from your News category, or have links to your latest podcasts.

In a previous post, I gave the code that would display the latest posts from a specific category in the sidebar. However, that code will not work in the main content part of the page. In order to display posts from a specific category in the main content section of a page, you need to use a variation on the WordPress Loop, which is as follows:
<?php query_posts('category_name=special_cat&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile;?>


To use this code, change the category name to whatever the name is of the relevant category, and change the number of posts displayed from 10 to whatever number you want. Where it says <!-- Do special_cat stuff... -->, put in all the code you usually use to display the title, date, category, etc. – whatever you need.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Relooking at the Page Links To Plugin

Thursday, June 21st, 2007

Since I discovered the Page Links To plugin, it’s become one of the plugins that I use most on my sites, particularly those where I’m using WordPress to create a CMS. I’ve reviewed it already (see the review here), but it seems that they have added a great features which was lacking in the previous version.

First, let’s just review what this plugin does: it allows you to create a Page, and then have that page link to any URL anywhere on the web. I mostly use it to link Pages in my navigation bar to Categories, or posts, but you could theoretically link a Page to any other page on the web.

It seems that in the new version, Pages links in the navigation are now highlighted when you click on them, even if they are linking using the plugin. This means that if you set a CSS style so that the current page you are on looks different in the navigation, this will apply also when the Page links using this plugin.

I highly recommend checking out this plugin…

Page Links To>> 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Using different style sheets for different templates

Sunday, June 3rd, 2007

I’m creating a site where the pages are divided into two sections: Hebrew and English. I need the Hebrew pages to use a template that basically looks the same as the English pages, but everything is switched around to right-to-left.

I created a copy of the style sheet and called it style-hebrew.css. In the copy, I made all the relevant changes so that everything is flipped around, which basically meant writing direction: rtl in a bunch of places, and floating things to the right instead of left, and vice versa. But now I needed a way to call this style sheet on the Hebrew pages.

First, I created a page template called hebrew-page.php. In this template, I replaced

<?php get_header(); ?>

with

<?php include ('header-hebrew.php'); ?>

Then I copied the header.php file and renamed it header-hebrew.php. In this file, I replaced the usual call to the style sheet:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

with the call to my new Hebrew style sheet:

<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style-hebrew.css" type="text/css" media="screen" />

Now, in the admin, whenever a Hebrew page is created, they just have to make sure to select the Hebrew Page template from the Page Template drop-down menu on the right-hand panel.

This method can be used for any site that needs to call different styles for different pages or categories. Just create another style sheet and header.php files, and call them in the appropriate places.

There may be a more efficient way to do this, but I have yet to discover it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

List only child Pages of a specific parent Page

Wednesday, May 9th, 2007

I am building a site for a client, and I want to list all the child Pages, which will be many, of one of their parent pages in the sidebar. To help you understand better, this client provides many services, so I wanted there to be a parent Page called “Services,” and this parent Page will have a list of child Pages, each of which goes into detail about each specific service.

I couldn’t find any information on how to do this, but then I came across a tag for categories that allows you to only list the subcategories of a specific category. This tag is as follows:

<?php wp_list_cats('child_of=8, 14'); ?>

By using this tag, you would only list the child categories of the categories with IDs of 8 and 14. So I decided to see if this would work with Pages, and it did!

So here’s the code I put in the sidebar to list only the child Pages of the Services Page, sorted alphabetically and omitting the title of “Pages”:

<?php wp_list_pages('child_of=2&sort_column=post_title&title_li=') ?>

Hurray!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Getting bored of how your dashboard looks? Try WordPress NiceAdmin

Thursday, April 12th, 2007

We bloggers spend a lot of time in the admin section of our WordPress blogs. It can get kind of boring looking at the same blue chunky lettering and design after a while. I decided to install the WordPress NiceAdmin plugin to add some variety to the same ‘ol same ‘ol.

It is so pretty! Gradients, a nicer font, details like pointers pointing at the upper-level of your admin that you are using. This is also useful if you plan on building sites for clients based on WordPress – they get a prettier backend, and it looks like it wouldn’t be that hard to customize it. Hurray! (Note to self: get a life).

WordPress NiceAdmin>>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Restricting Pages to logged in users

Monday, April 9th, 2007

redwing studio has a detailed description how to set up a Page in your WordPress blog so that only logged in users can see the content. You can restrict access to a page by making it private, or by using a Role Manager plugin, but this method allows the following:

  • The Page shows up on the navigation bar (it doesn’t with the other methods)
  • If a user tries to view it and is not logged in, you can have the page display whatever you want, such as a login form and/or a message telling them they must log in to see the content (the page just appears blank with the other methods)

To accomplish this, you need to create a unique Page template, and modify the code.

User only/protected pages in WordPress>> 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Premium News Themes