Tag Archives: template

Make WordPress K2 Themes Refresh Faster

The pages with wordpress K2 theme loads fast when you click them, but if you try to refresh the page it will be very slow to load, while other themes don’t have this problem. To fix this follow this guide taken from K2’s forum:

find the folder js inside the K2 folder, then for each .js.php file comment out the ‘require(….. wp-blog-header.php)’ line and replace ‘!get_settings(‘gzipcompression’)’ with ‘( ob_get_length() === FALSE)’. After that the first few lines should look like this:

// check to see if the user has enabled gzip compression in the WordPress admin panel
if ( (ob_get_length() === FALSE) and !ini_get('zlib.output_compression') and ini_get('output_handler') != 'ob_gzhandler' and ini_get('output_handler') != 'mb_output_handler' ) {

Then add the following lines on the top of the files livesearch.js.php and rollingarchives.js.php after the php tag:

// Echo a translated string.
function _e($text, $domain = 'default') {
global $l10n;

if (isset($l10n[$domain]))
echo apply_filters(‘gettext’, $l10n[$domain]->translate($text), $text);
echo $text;

For livesearch.js.php, comments.js.php:
replace all
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',realpath(dirname(__FILE__) . '/../'))
There are two instances of these in comments.js.php, and one in livesearch.js.php.

After all these the pages will refresh very fast.

Original post in which this guide is taken from…

Today I changed my blog’s template to TripleK2

Today I changed my blog’s template to TripleK2, a theme based on K2 but with three columns, with a very nice style TechnoBlue(found in the same website). Now I have one sidebar on the left and one on the right. The theme is similar to 3k2, but I didn’t use 3k2 since the last time it’s updated is like half years ago, it uses a much older version of K2 which probably has some bugs that cause trouble. I really liked the style TechnoBlue, since it looks very nice and neat, if you’re looking for a three-column K2 with a nice style it should be your choice.


How to add social bookmarking in wordpress

In the entry Let Your Blog Be Social nongeek talked about the advantage of social bookmarking and how to add bookmark area in blogger’s template. You can also do that in wordpress too, using the same way he said in that post, but substitute Blogger’s template tags with wordpress’s tags. For example, if you want a “Submit to del.icio.us” line you should add

Submit to: <a href="http://del.icio.us/post?url=<?php the_permalink()
?>;title=<?php the_title(); ?>" >del.icio.us</a>

instead of

Submit to: <a href="http://del.icio.us/post?url=<$BlogItemPermalinkURL$>;title=<$BlogItemTitle$>"

to your template’s php file before or after the line <?php the_content('something'); ?> depending on if you want it to appear before or after the posts.

If you want to submit to Digg there’s a great WordPress plugin called Digg This for WordPress Reloaded that lets you to add a very cool “Digg This button” like the one I have in the posts, without changing the template’s codes. It also comes with a Complete admin interface with options for many customizations, like positioning the button, what pages to show the button, the style of the button , and many others.

How to make links to open in a target frame

To make links in a web page to open in a target frame or new window all you need is to add target=”_blank” in between the <a href=”***”> section of the html code, where *** is the default target frame.

target=”_blank” Opens a page in new window
target=”_self” Opens a page in the same frame
target=”_top” Opens a page in the top page breaking all frames
target=”_parent” Opens a page in parent frame

We can also use target=”frame or iframe’s name” to make the link to open in that frame or iframe.

To make links to open in a target frame or new window by default add <base target=”***”> in between the <head> section of the code. This also works for Blogger’s templates, for Blogger Beta’s templates since it had to be XML compliant you have to add the closing tag </base> at the end to <base target=”***”> to make it work.

Something about Blogger’s template format and tips to show html code in posts

Did you know that Blogger.com‘s template is just a special HTML file with some special template tags in between? That means you can customize your blog just like editing a web page.

That gives you the maximum flexibility to customize the blog’s design. You can add and change anything you want from top to bottom. To learn more about the template tags and what they do please visit http://help.blogger.com/bin/answer.py?answer=42095.

I found it useful to put <meta name=”description” content=”<$BlogDescription$>”> into your template’s <head> section, so that search engines will show your website’s description in their result instead of some stupid message like “Notify Blogger about objectionable content. What does this mean? Blogger · Send As SMS · Get your own blog · Flag Blog · Next blog” if you have NavBar on.

If you want to put HTML codes in your blog to let others copy you can’t paste them directly in the Edit Posts window, it will give you some error message, here’s a way to get around it:

  • Copy the codes you want to paste into the post and paste it into a HTML editor (like FrontPage)’s design section.
  • Check the source code of the contents you just pasted, you will notice that the symbols “<“, “>”, or others became &??; now you can copy those codes with &??; and paste them in the posts, although you still see &??; now, when you published your post the &??; will become the appropriate symbol again when it show in the blog.

Note: You can’t get away with it by putting the unmodified codes inside the text box, Blogger’s editor still won’t let you save it even if you do that.