Recently when I attempted to log in to my WordPress admin page at ‘http://domain.org/wp/wp-admin’, the page was blank. I had no idea what was going on. My local WordPress install was working fine, so I checked my remote files against my locals and saw nothing out of the ordinary. Then it simply hit me that a lot of the books and tutorials on the function.php file always mentoined weird results to your page if there were any line breaks at the beginning or end of your file. So I checked and sure enough there were some spaces at the end of my functions.php file which I deleted and uploaded it all was right again.
Archive for the ‘WordPress’ Category
WordPress: Display Child Category
For my new WordPress theme, I wanted to display the child category for my portfolio projects. I have placed all my objects within main categories(such as Blog and Portfolio) and given them more specific categories for description within the parent. When doing a loop to display my latest portfolio posts, I wanted to display the category(ies), but since the heading for the section is entitled “Latest Projects”, it would be redundant to show that the items are categorized within ‘Portfolio’.
The WordPress function to display the catagory of a post is
<?php the_category(', '); ?>
This will display all the categories, parent and children. To get the child, we have to load a string with the child after checking if there is in fact a child category.
<?php
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(11, $childcat)) {
echo $childcat->cat_name;
}}
?>
The New
This is the new site design. It is a WordPress theme which utilizes the following:
Plugins:
- vSlider
- SEO Ultimate
- Google XML Sitemaps
- Special Recent Posts
- Akismet
Added functions:
- multiple custom excerpt sizes
- multiple sidebar and footer widgets
- defined categories to separate posts
- custom thumbnail sizes
- Google Analytics at the end of pages