Sponsors

ad

ad

Want to advertise here? Go to Text link Ads.

Text Link Ads


Internet Blog Top Sites

For Developers - Display Page and Post Ids

June 10th, 2008

for-developers-display-page-and-post-ids

For those who’ve been using/developing WordPress sites for a while now, you probably have become quite reliant on knowing the actual id number of posts and pages, as well as categories, especially for customizing navigation, as well as creating category specific templates. You probably have also been equally frustrated at them being removed from the admin in 2.5+, I know I have. Well, leave it to the community to solve a problem. Nick Ohrn has cooked up a nice little plugin that replaces these ids, without seemingly compromising the layout of the page one bit. Certainly a worthy plugin for your dev toolbox. Once a site is developed, you could easily turn it off if you are concerned about confusing users, and then activate it as needed for follow up work. However, it certainly is much easier than mousing over each page and writing down the ID, especially on page heavy sites.

Simple Members Only Section

June 10th, 2008

simple-members-only-section

Recently, while helping someone setup a members only section on their site, I found that there wasn’t an obviously simple solution that worked with 2.5.x. Several plugins exist that attempt to solve the problem, however, as I said, they are either no longer available, don’t work in 2.5.x, or simply are ridiculous solutions.

The site in question simply wanted certain pages for members (from a subscription based service). There was no budget to do anything fancy like have a shopping cart integrated with user creation, just a simple way to add the 50+ existing members and new members. So after poking around and wasting my time trying to adapt the aforementioned plugins, the venerable Role Manager plugin seemed to fit the bill fairly easy for my needs. Members can be added as subscribers, turning off registration for the site. Subscribers can be edited to view private pages. Voilá!

As far as adding the initial 50+ members, though not tested yet, Dagon Designs Import Users plugin seems to fit the bill, and since I’ve been using their forms plugin, I have confidence this will work quite well.

Finally, by default, when you list a page that is private, you get a Private: prefacing the page title. Well, that’s not exactly what I want, so I found several different, though similar solutions. Simply add a function to your theme’s function.php file to either strip or change the output.
function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'Members Only - ',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');

Where you can either change the “Members Only - ” to what ever you want, or leave it out, ie, ('Private:','',$title);.

I’m sure some issues will crop up, and I will follow up after I’ve fully implemented the ideas I’ve outlined, but I wanted to share the thought process (and possibly save someone the same time consumption googling every combination of “wordpress/members/pages/private” they can come up with) as well as document it for my own reference. Any other tips would be greatly appreciated.