WordPress was originally created as a weblog or blog platform
But now WordPress has grown so powerful that you can use it to create any type of website and use it as a Content Management System (CMS). In this article, I’m going to share some of my WordPress tricks with you on how to make a better WordPress theme. I’m not a programmer nor developer, so I will focus more on the frontend development. Oh yeah, I forgot to mention that WordPress has made it so easy that even a non-programmer (designer like me) can build a wonderful website. My WordPress sites included: N.Design Studio, Best Web Gallery, Web Designer Wall, and some free WordPress Themes.
WordPress Conditional Tags- Conditional Tags are very useful when creating a dynamic WordPress theme.
It allows you to control what content is displayed and how that content is displayed. Here are couple sample uses of Conditional Tags:
Dynamic Highlight Menu- Here is what I used to create a dynamic highlight menu on Best Web Gallery. In the first list item, if it is Home or Category or Archive or Search or Single, add to the <li> tag, which will highlight the “Gallery” button. Second item, if it is page with Page Slug “about”, add.
<ul id="nav"> <li<?php if ( is_home() || is_category() || is_archive() || is_search() || is_single() || is_date() ) { echo ''; } ?>><a href="#">Gallery</a></li> <li<?php if ( is_page('about') ) { echo ''; } ?>><a href="#">About</a></li> <li<?php if ( is_page('submit') ) { echo ''; } ?>><a href="#">Submit</a></li> </ul>
Dynamic Title tag- Again, I use Conditational Tags to output dynamic <title> tag in the header.php.
<title> <?php if (is_home()) { echo bloginfo(‘name’); } elseif (is_404()) { echo ’404 Not Found’; } elseif (is_category()) { echo ‘Category:’; wp_title(”); } elseif (is_search()) { echo ‘Search Results’; } elseif ( is_day() || is_month() || is_year() ) { echo ‘Archives:’; wp_title(”); } else { echo wp_title(”); } ?> </title>
If you more quires contact us
