Internet Madman – Tech & Web News

Bringing you web hotness…

Browsing Posts in WordPress Tips & Tricks

If you are like me, you probably want your website to have excellent navigation, and let people know where they are on your website pretty much all the time.

SO I WAS LOOKING FOR A WAY TO DISPLAY SOME INFORMATION LIKE CATEGORY NAME IN WORDPRESS (to be a header for an ordered list of that category’s other posts.) That topic will be covered later by the way.

So I made it happen, but then my Word Press pages were showing the header for the category ‘uncategorized’ (Not cool!)

Here’s a good way to show the header on all pages except your main web pages.

global $post;
$category = get_the_category();
if ( is_page() ) {
}
else{
echo 'Posting Filed in ' .$category[0]->cat_name;
}
?>

***UPDATE***

The above code works great, but unfortunately I just noticed that it still shows up even if there are no posts in that category. That’s fine because I am using that page as an index page, and there aren’t supposed to be ‘POSTS’ in that category, however just having a header hanging out there is kind of stupid (that’s what I’m using this code for, a header in a widgetized sidebar)

Use this PHP instead…

global $post;
$category = get_the_category();
if ( is_page() ) {
}
else{
if ( have_posts() ) {
echo $category[0]->cat_name;
}
}
?>

Popularity: 5% [?]

import-from-wordpressAs you can see, I import from an RSS file sometimes into installations of WordPress. Default PHP installations limit your maximum filed upload size to 2MB. Even if you increase this setting in your php .ini file, the WordPress mechanism will not import a much larger file.

I recommend limiting file sizer to about 1.5 MB.

This way, you will not lose any posts that you are trying to import. It seems to break around 950 – 980 posts. It’s happened multiple times, even though if you increase you PHP upload file maximum limit to 20 MB or more, and the tool report this setting in the administration &raguo; import area, the import WILL FAIL.

So for people that have went to all the trouble to create a program to create RSS to import into WordPress, be sure to keep the file size below 2MB.

Popularity: 29% [?]

WordPress - front-page-categories
Wow. Can you believe there’s not a simple way to do that? It took me fourteen hours to find the right combination of plug ins, theme hacks and cc, and a few other tweaks to do something in WordPress that in my humble opinion should be already built in.

So all I wanted to do over at Music City was display all my categories on my WordPress front page (which I use as a CMS). After hours of trying plug ins that didn’t work, or had limited functionality, or just didn’t work, I quickly grew frustrated. I’m not primarily a PHP programmer, so I wasn’t about to attempt to write my own plug in. Most plug ins are widgets, and I wanted my categories on my static front page, and boy… It was as if I was asking to move a mountain.

Here’s step by step how I got it to work.

1. First of all, you’ll need to search up and install Article Directory Plug In by Dimox from the WordPress plugin page. *Make sure you follow all the directions in the ReadMe file.

2. Make sure you have made you homepage a static page, and not recent posts.

3. Copy your page template (.php file) to a new file, and upload it to your theme folder.

4. Make sure your copy of the template you just created has this code at the top,

Note: where is says, “Your Template Name” shows up in page admin area of WorPpress.

5. Okay Wherever you want the categories to show up on this page, insert

6. Configure your options via the Article Directory options page in the WordPress “Settings” admin area.

7. Depending on how you want it to look, you will probably have to edit the article-directory/article-directory.php file via WordPress plugins > edit area. (the .css file for the plugin has to be moved into you themes folder, of the current theme you are using, and use the .css import function to import that css into you themes css file. Then make sure you editing that copy if you want to modify additional styling via that. (Not the copy in the plugins directory)

8. Edit your front page, and make sure you select that that page will use the copy of the template you named and uploaded and inserted the article directory code into.

9. Note that the front page should be the only page which used that template if you want the categories to only appear on the front page. Of course you can insert the article directory php code to make it show up anywhere in any template file, but that kind of defeats the purpose of what I’ve explained how to do, and the styling you create is global, remember that.

10. Enjoy your new directory style front end. Don’t forget to add your regular front page content, and make sure in step #5 you’ve inserted the article directory code in the correct spot where you want it to show up.

11. Also please not I also had to tweak the plug in to show an image in front of master categories, which I didn’t show how to do. Hell, if you can follow these directions, you can figure that much out on you own I suppose.

12. I suppose you also would like to turn off comments for your front page, and make sure that it doesn’t show up as, “Comment Closed” or “Comments Off” right? There’s a simple way to do that. Simply edit your comment.php file in your theme, find the string that displays when you have comments turned off, and replace that string with nothing. Then it simply prints a blank string. You might also have to find out if you theme prints a “Comments” header label, and remove that as well for that template file.

Good Luck!

I hope you’ve enjoyed my article on how to place all you WordPress categories on your static front page.

Popularity: 49% [?]