Archive for the ‘WordPress’ Category

AWStats – How is the Add To Favorites (Estimated) Feature Calculated?

Monday, January 9th, 2006

Quick Answer:
A quote from the AWStats glossary:

Add To Favourites:
This value, available in the “miscellanous chart”, reports an estimated indicator that can be used to have an idea of the number of times a visitor has added your web site into its favourite bookmarks.
The technical rules for that is the following formula:
Number of Add to Favourites = round((x+y) / r)
where
x = Number of hits made by IE browsers for “/anydir/favicon.ico”, with a referer field not defined, and with no 404 error code
y = Number of hits made by IE browsers for “/favicon.ico”, with a referer field not defined, with or without 404 error code
r = Ratio of hits made by IE browsers compared to hits made by all browsers (r < = 1)

As you can see in formula, only IE is used to count reliable "add", the "Add to favourites" for other browsers are estimated using ratio of other browsers usage compared to ratio of IE usage. The reason is that only IE do a hit on favicon.ico nearly ONLY when a user add the page to its favourites. The other browsers make often hits on this file also for other reasons so we can't count one "hit" as one "add" since it might be a hit for another reason.
AWStats differentiate also hits with error and not to avoid counting multiple hits made recursively in upper path when favicon.ico file is not found in deeper directory of path.
Note that this number is just an indicator that is in most case higher than true value. The reason is that even IE browser sometimes make hit on favicon without an "Add to favourites" action by a user.

(more…)

Adhesive Plugin – Styling not working

Monday, January 9th, 2006

The Adhesive WordPress Plugin lets you mark certain posts as “sticky” so that they always stay at the top of your website. I think this is particularly useful for providing an introduction to a blog, or it would help you to use WordPress as a more of a content management system than a blogging platform. For example your front page content appears at the top of your website, and then all of the blog posts under that appear like news updates perhaps.

The problem I was having was that it was not adding an “adhesive_post” class correctly to the entry that was sticky. It seemed to be wrapping my entire website in that class.
(more…)

How to add digg this, reddit this, et al links to WordPress Posts

Saturday, January 7th, 2006

Want submission links to all the social browsing/bookmarking websites to appear on each of your posts? Then just follow my instructions.
(See bottom of this post for an example and here’s an image of that example in case I ever stop using it on this site someday.)

I searched around for plugins and any advice on how to do this. Upon having no luck I decided to take matters into my own hands. Here’s what you do:

  1. Download these images and upload them to a directory on your webserver.
    del.icio.us
    Digg
    FURL
    Yahoo! My Web 2.0
    Reddit

  2. Now go find these two files in the current theme you are using and get them ready for editing:
    index.php
    single.php

  3. Edit these files by inserting this text between where the post content is printed and the closing parts of the post is printed. (Of course you must add the URL’s of those images from step 1 to this code before it will work.)

    <div class="spreadtheword">
        <a title="Save To del.icio.us" href="http://del.icio.us/post?url=<?php the_permalink() ?>;title=<?php bloginfo('name'); ?> &gt;&gt; <?php the_title() ?>"><img src="[URL DIRECTORY TO WHERE YOU UPLOADED YOUR IMAGE]/delicious.gif" alt="del.icio.us" border="0"></a>&nbsp;|&nbsp;
        <a title="Submit To Digg" href="http://digg.com/submit?phase=2&url=<?php the_permalink() ?>" ><img src="[URL DIRECTORY TO WHERE YOU UPLOADED YOUR IMAGE]/digg.gif" alt="Digg" border="0"></a>&nbsp;|&nbsp;
        <a title="Save To FURL" href="http://www.furl.net/storeIt.jsp?t=<?php the_title() ?>;u=<?php the_permalink() ?>" ><img src="[URL DIRECTORY TO WHERE YOU UPLOADED YOUR IMAGE]/frul.gif" alt="FURL" border="0"></a>&nbsp;|&nbsp;
        <a title="Save to Yahoo! My Web 2.0" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?t=<?php the_title() ?>;u=<?php the_permalink() ?>"><img src="[URL DIRECTORY TO WHERE YOU UPLOADED YOUR IMAGE]/yahoomyweb.jpg" alt="Yahoo! My Web 2.0" border="0"></a>&nbsp;|&nbsp;
        <a title="Save to Reddit" href="http://reddit.com/submit?url=<?php the_permalink() ?>;title=<?php the_title() ?>" ><img src="[URL DIRECTORY TO WHERE YOU UPLOADED YOUR IMAGE]/reddit_btn.gif" alt="Reddit" border="0"></a>
    </div>
    

    As an example here is how my final single.php looks (remember you’re also doing this to index.php):

    <?php get_header(); ?>
    <div id="content">
        <?php while (have_posts()) : the_post(); ?>
            <div class="post">
                <h3 class="storytitle" id="post-<?php the_ID(); ?>">
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php if (function_exists('ImageHeadline_get_ttf_font_name')) the_title('-image-'); else the_title(); ?> </a>
                </h3>
                <p class="postdate"><strong><?php the_time('l, F jS, Y') ?></strong> at <strong><?php the_time() ?></strong> by <strong><?php the_author(); ?></strong> <?php edit_post_link('Edit','<small>|','</small>'); ?></p>
                <div class="storycontent">
                    <?php the_content('<br /><strong">Read the rest of this entry &#187;</strong>'); ?>
                </div>
    
                <div class="spreadtheword">
                    <a title="Save To del.icio.us" href="http://del.icio.us/post?url=<?php the_permalink() ?>;title=<?php bloginfo('name'); ?> &gt;&gt; <?php the_title() ?>"><img src="http://www.answermysearches.com/wp-content/themes/cleanbreeze/images/delicious.gif" alt="del.icio.us" border="0"></a>&nbsp;|&nbsp;
                    <a title="Submit To Digg" href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink() ?>" ><img src="http://www.answermysearches.com/wp-content/themes/cleanbreeze/images/digg.gif" alt="Digg" border="0"></a>&nbsp;|&nbsp;
                    <a title="Save To FURL" href="http://www.furl.net/storeIt.jsp?t=<?php the_title() ?>;u=<?php the_permalink() ?>" ><img src="http://www.answermysearches.com/wp-content/themes/cleanbreeze/images/frul.gif" alt="FURL" border="0"></a>&nbsp;|&nbsp;
                    <a title="Save to Yahoo! My Web 2.0" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?t=<?php the_title() ?>;u=<?php the_permalink() ?>"><img src="http://www.answermysearches.com/wp-content/themes/cleanbreeze/images/yahoomyweb.jpg" alt="Yahoo! My Web 2.0" border="0"></a>&nbsp;|&nbsp;
                    <a title="Save to Reddit" href="http://reddit.com/submit?url=<?php the_permalink() ?>;title=<?php the_title() ?>" ><img src="http://www.answermysearches.com/wp-content/themes/cleanbreeze/images/reddit_btn.gif" alt="Reddit" border="0"></a>
                </div>
    
                <div class="feedback">
                    <?php link_pages('<span class="pagelink">Pages: ', '</span> | ', 'number'); ?>&nbsp;
                    <a href="<?php trackback_url(display); ?>" title="Trackback URI"><strong>Trackback</strong></a>&nbsp;
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/link.gif" border="0" alt="Permanent link to <?php the_title(); ?>" /> Permalink</a>
                    <?php comments_popup_link('<img src="'.get_bloginfo('template_url').'/images/comments.gif" alt="Comments Icon" /> Post your comments &#187;', '  <img src="'.get_bloginfo('template_url').'/images/comments.gif" alt="Comments Icon" /> 1 Comment &#187;', '  <img src="'.get_bloginfo('template_url').'/images/comments.gif" alt="Comments Icon" /> % Comments &#187;'); ?>&nbsp;
                    <img src="<?php bloginfo('template_url'); ?>/images/filed.gif" alt="Category Icon" /> Filed under: <?php if (function_exists('the_nice_category')) the_nice_category(); else the_category(', '); ?>
                </div>
                <!-- <?php trackback_rdf(); ?> -->
            </div>
            <?php comments_template(); ?>
        <?php endwhile; ?>
        <?php if (function_exists('updateBlogTimePNG')) : ?><div id="blogtimes"><img src="/wp-images/blogtimes.png" alt="blogtimes" width="480" height="65" /></div><?php endif; ?>
    </div>
    <?php get_sidebar(); ?><?php get_footer(); ?>
    

    Now after you’ve saved those changes you should be able to see the links at the end of each post.

  4. The final step which is optional is to edit the style.css file in your theme’s directory to handle the new class “spreadtheword”.
    Here’s what I added to my stylesheet:

    .spreadtheword {
        text-align: right;
        clear: both;
        font-size: 10px;
        padding-bottom: 10px;
    }
    

And that’s it. Good luck, and feel free to post questions or improvements in the comments section.

Hmm, and if you’re really ambitious go ahead and make a plugin that does this for all of this for us.

And of course feel free to push the del.icio.us, digg, reddit,et al buttons below ;-) .


Updates, We’ve got updates:

  1. This generator looks promising. It claims to do what I do here but for a lot more services and supports WordPress.
  2. I removed these links from this this site because no one was using them :-( . Instead of questioning the quality of my own posts, I made up the theory that anyone who cares enough to post something to one of these sites already has the bookmarkletts etc to do it and doesn’t need these links.
  3. The kind folks at reddit have provided a few more button images to choose from.
  4. The Digg button seems to always prompt to add a new digg even if the link is already dugg. I’m looking into this.

Upgrading to WordPress 2.0 Help – upgrade.php Gives Me Server Error 500

Friday, January 6th, 2006

So I carefully followed all of the steps in the WordPress upgrade guide but when I got to step 9 (Run the WordPress upgrade program) I was hit with a server 500 error*

I guessed properly that it was a permissions problem. I tried setting all of the permissions to every WordPress related file I could find to 755 but it didn’t help.

Finally in one last frusterated attempt I changed the permissions on every single file in my directory to 755 and that worked. So the problem was probably the permission on some file that I didn’t think of before.
If you can ssh into your web hosting account you can just run something like this:
$ chmod -R 755 html

Of course there are probably security issues or other problems with having every single file have permissions of 755 so probably don’t leave them like that. (An exercise left to the reader ;-) )

*Specifically it said:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, root@peregrinehw.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

[tags]WordPress 2.0,chmod,Permissions[/tags]

WordPress – problem: quotes in pre tag are preceded by backslash

Monday, January 2nd, 2006

To prevent this the suggested workaround is to use: &quot; in place of: ”

This WordPress bug report was where I found this information.

The terms I searched for were:

  1. Searched WordPress website for pre quotes backslash
  2. Searched Google for: wordpress pre quotes backslash

I’m not sure if this is an issue with WordPress 2.0. I haven’t upgraded yet.