Dynamic Highlight Menu in Wordpress

Posted: February 3rd, 2009 | Author: Barrie Adams | Filed under: Wordpress Hacks | Tags: , , , , | No Comments »

WordPress HacksThis allows you to theme/style and control the currently selected menu tab in CSS by adding a class=”current” on it.

If Home, or Category, or Archive, or Search or Single page is selected, class=”current” will be included in

  • If category with category slug of css or showcase, class=”current” is added.


  • Display Most Recent Twitter Entry in Wordpress

    Posted: February 3rd, 2009 | Author: Barrie Adams | Filed under: Wordpress Hacks | Tags: , , , , | No Comments »

    WordPress Hacks // Your twitter username.
    $username = "TwitterUsername";
    // Prefix - some text you want displayed before your latest tweet.
    // (HTML is OK, but be sure to escape quotes with backslashes: for example href="link.html")
    $prefix = "";
    // Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)
    $suffix = "";
    $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";
    function parse_feed($feed) {
    $stepOne = explode("", $feed);
    $stepTwo = explode("
    ", $stepOne[1]);
    $tweet = $stepTwo[0];
    $tweet = str_replace(”<”, “<”, $tweet);
    $tweet = str_replace(”>”, “>”, $tweet);
    return $tweet;
    }
    $twitterFeed = file_get_contents($feed);
    echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
    ?>


    Display an External RSS Feed in Wordpress

    Posted: February 3rd, 2009 | Author: Barrie Adams | Filed under: Wordpress Hacks | Tags: , , , , | No Comments »

    WordPress Hacks wp_rss('http://wpforums.com/external.php?type=RSS2', 5); ?>


    Include PHP on a Single Page in Wordpress

    Posted: February 3rd, 2009 | Author: Barrie Adams | Filed under: Wordpress Hacks | Tags: , , , , | No Comments »

    WordPress HacksReplace is_home with the page you want it to only appear on.


    Dynamic Title Tags for SEO in Wordpress

    Posted: February 3rd, 2009 | Author: Barrie Adams | Filed under: Wordpress Hacks | Tags: , , , , | No Comments »

    WordPress Hacks<?phpif (is_home()) { echo bloginfo('name');<br /> } elseif (is_404()) {<br /> echo '404 Not Found';<br /> } elseif (is_category()) {<br /> echo 'Category:'; wp_title('');<br /> } elseif (is_search()) {<br /> echo 'Search Results';<br /> } elseif ( is_day() || is_month() || is_year() ) {<br /> echo 'Archives:'; wp_title('');<br /> } else {<br /> echo wp_title('');<br /> }<br /> ?>