Use Only Genuine Interocitor Parts

Add to Technorati Favorites

Endorsements

Firefox 3

Remove Fancy Quotes From WordPress

Wednesday, June 18th, 2008 at 2:09 pm by Kenny

If you're annoyed by the fancy quotes that WordPress replaces your normal quotes with (i.e. “these quotes” rather than "these regular quotes"), there's an easy way to get rid of them. Just use Semiologic's Unfancy Quote Plugin For WordPress and presto chango, your fancy quotes are gone!

I had found some lower-level hacks to WordPress and some crazy-complex Javascript that fixed this, but none of them were as simple and easy to use as Semiologic's solution.


  • E-mail this story to a friend!
  • Google
  • bodytext
  • Technorati
  • del.icio.us
  • Slashdot
  • TwitThis
  • Furl
  • Fark
  • Reddit
  • StumbleUpon
  • Facebook

Remove Generator Field From WordPress Meta

Wednesday, June 18th, 2008 at 2:03 pm by Kenny

WordPress automagically interjects meta content specifying that the generator of the webpage is WordPress and, specifically, what version it is. Like this:

<meta name="generator" content="WordPress 2.5.1" />

If you want to remove that, there's an easy way to do it. If you don't already have a functions.php file in your theme, create one. Make sure that it starts with <?php and ends with ?> and has NOTHING outside those tags or it will cause your theme to yak.

Now add the following line to your functions.php file:

remove_action('wp_head', 'wp_generator');

And that should do it! Now you can go through all your plugins and remove the comments and other garbage they interject in order to try to hide the fact that you're running WordPress.


  • E-mail this story to a friend!
  • Google
  • bodytext
  • Technorati
  • del.icio.us
  • Slashdot
  • TwitThis
  • Furl
  • Fark
  • Reddit
  • StumbleUpon
  • Facebook

Add A Digg Badge To WordPress Posts/Pages

Saturday, August 25th, 2007 at 12:38 pm by Kenny

I know there are a lot of widgets and plugins for WordPress out there for adding a Digg badge to posts (I know, because I tried half a dozen or so of them) but I didn't find any that worked consistently and provided the functionality I wanted. After researching the Digg Tools API and a few other examples online, I've composed this block of code for generating Digg badges.

To add a Digg badge to your WordPress posts or pages, simply add the following code block immediately before or after the PHP block that contains the_content(). For posts, you would want to modify the Main Index Template, Single Post, and Archives theme files. For pages, you simply need to modify the Page Template theme file. Here's the code:

<div class="diggLink">
    <script type="text/javascript">
        digg_url = '<?php the_permalink() ?>';
        digg_title = '<?php the_title(); ?>';
        //digg_topic = 'TOPIC'; // replace TOPIC

        /*
        Use the output buffer to capture the text
        output from the_ID() rather than having
        it rendered to the page.
        */

        digg_bodytext = '<?php
            ob_start();
            the_ID();
            $postID = ob_get_contents();
            ob_end_clean();

            /*
            Get the body of the post, remove HTML,
            remove carriage returns and line feeds,
            escape 's, return only the first 350 char.
            */
            $postObj = get_post($postID, OBJECT);
            $body = strip_tags($postObj->post_content);
            $body = str_replace(chr(10), '', $body);
            $body = str_replace(chr(13), '', $body);
            $body = addslashes($body);
            echo substr($body, 0, 350);
        ?>';
    </script>
    <script src="http://digg.com/tools/diggthis.js"
        type="text/javascript"></script>
</div>

I've also added a class to the wrapping DIV and added it to the stylesheet for my theme to style the positioning of the Digg badge. I place the above code right before the the_content() block and this CSS class is what positions my Digg badge to the right of my posts.

.diggLink
{
    float: right;
    margin-bottom: 4px;
    margin-left: 4px;
}

If you'd like to set your posts to all submit to one particular topic, you can uncomment the line that refers to digg_topic in the code block and then change TOPIC to the topic you'd like to use. You can find the list of topics on the Digg Tools API page.

If you have any questions, feel free to comment and ask me. By the way, this same code block is currently in use at Pac Ten Review.


  • E-mail this story to a friend!
  • Google
  • bodytext
  • Technorati
  • del.icio.us
  • Slashdot
  • TwitThis
  • Furl
  • Fark
  • Reddit
  • StumbleUpon
  • Facebook