WordPress.org

Ready to get started?Download WordPress

Forums

1 month after WP install (7 posts)

  1. Mark Jaquith
    WordPress Lead Dev
    Posted 10 years ago #

    Well, I've been running WordPress for just over a month, and I couldn't be happier.
    Here is my site: Tempus Fugit
    As I was a Movable Type convert, I wanted to be able to do a lot of the things I was able to do in Movable Type, so I've written dozens of plugins to do various things.
    Here's a quick list of some of the hacks and tweaks:

    • Basic static content system ('about me,' 'contact,' etc) with custom mod_rewrite rules
    • Custom breadcrumb plugin with support for static pages and display in the title
    • Macro to add fancy styling to post images
    • Macro to add <b>class="extlink"</b> to links that reference external websites
    • Recognizes comments that are made by me, and changes the class of the author text
    • Automatic redirection to a mobile version for mobile clients (PDA, cell phone, etc)
    • 404 requests are sent to a WP search, thus if you go to http://www.txfx.net/michael jackson you will get a listing of all posts containing those words
    • Show/hide comments on certain pages (easy to configure which pages get them), and show/hide extended entry on certain pages (again, easy to change which pages get them)
    • Custom prerendering of post content. The first time a post is viewed, all the filters are applied, and then the rendered text is saved to the database. The next time the entry is viewed, the prerendered version is show, resulting in a 10-60% speed increase
    • Recent entries list is cached whenever an entry is published, edited, or deleted, and the cached version is displayed, which saves about 20 MySQL queries
    • Comment subscription option (if a user so wishes, they will get e-mails when people respond)
    • Option to not save user info to cookie (for privacy reasons, such as people who post from public computers). Also, option to manually delete the cookie
    • Post dates and page titles are dynamically rendered into images using True Type Fonts and then cached
    • Live comment preview with support for paragraphs and line breaks
    • Return commenters get a reordered form, with the comment form being first, and their saved info being tucked away below

    That's about all that I can think of right now. I've made tons of little tweaks. Let me know what you think.

  2. unixman
    Member
    Posted 10 years ago #

    Can you share your .htaccess entry for the 404 beeing sent to search? Thanks!

  3. carthik
    Member
    Posted 10 years ago #

    That is a pretty exhaustive set of modifications. Could you please share them with us, with all the code and if possible instructions? I am sure a lot of people will need at least some of them.

  4. vsa
    Member
    Posted 10 years ago #

    That 404 mod/hack is great. Can you share it?

  5. Mark Jaquith
    WordPress Lead Dev
    Posted 10 years ago #

    unixman:
    The line in .htaccess is simple:
    ErrorDocument 404 /404.php
    Here are the contents of 404.php:
    <?php
    $site_prefix = "http://txfx.net/index.php";
    $request = trim($_SERVER['REQUEST_URI'],"/");
    $uArray = explode("/",$request);
    $index = count($uArray) - 1;
    $search_terms = urldecode(stripslashes($uArray[$index]));
    $reged = preg_split('/(\".*?\")/',$search_terms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
    $search_term = urlencode(implode(" OR ", $reged));
    $full_search_url = $site_prefix . '?s='. $search_term . '&submit=Search';
    header("Location: $full_search_url");
    exit();
    ?>

    It's some modified code from a script that did MT searches.
    2fargon: I'm working on a comprehensive colophon that should serve as a fairly good "how did you do this?" roadmap.
    thomasmaas:
    No one knows that better than I... my design was stagnating and becoming overgrown months ago, and for the past month, WP conversion and tweaking has occupied all my time. But now that I have it functionally where I want it, I'm going to spend some time making it flow better. I appreciate the input!

  6. unixman
    Member
    Posted 10 years ago #

    Mark, I have also been looking for the WP "macro" to denote outside links differently without success. Care to share how you did it?

  7. Mark Jaquith
    WordPress Lead Dev
    Posted 10 years ago #

    Sure, David (unixman)!
    Here's the plugin I wrote. You don't have to configure anything really... it should just work out of the box. Keep in mind that this adds both <b>class="extlink"</b> and <b>target="_blank"</b>. If you don't want external links opening in new windows (as I see they do not on your site), make sure and take that part out.
    I'm not claming this is brilliant... it is probably inefficient, and I know it took me a long time to write... but it works! One drawback right now... it only works for http:// links. Anything else, like ftp:// or irc:// won't work, but that's easy to fix.
    <?php
    /*
    Plugin Name: Identify External Links
    Plugin URI: http://www.txfx.net/
    Description: Searches the text for links outside of the domain of the blog. To these, it adds <b>target="_blank"</b> and <b>class="extlink"</b>
    Author: Mark Jaquith of Tempus Fugit
    Author URI: http://www.txfx.net/
    */

    function parse_domain_name($url){
    preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $matches);
    $host = $matches[2];
    preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
    return $matches[0];
    }

    function parse_external_links($matches){
    if (parse_domain_name($matches[2]) == parse_domain_name($_SERVER["HTTP_HOST"])){
    $return = '' . $matches[4] . '';
    } else {
    $return = '' . $matches[4] . '';
    }
    return $return;
    }

    function wp_external_links($text) {
    $pattern1 = '/(.*?)<\/a>/i';
    $text = preg_replace_callback($pattern1,'parse_external_links',$text);
    return $text;
    }
    add_filter('the_content', 'wp_external_links', 2);
    add_filter('the_excerpt', 'wp_external_links', 2);
    add_filter('comment_text', 'wp_external_links', 2);
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.