Posts in the category "WordPress".

Serene Saturday

I was going to trackback the Comment text plugin page, but I noticed the plugin author had noticed the missing quote problem and corrected it. I, however, hacked it together myself. It just needed some complexity to the code that builds the comment links:

<!-- First link, to get a custom text, around line 50 -->
echo '<a href="' . get_permalink() . '#comments' . '">' ."$text ($number)" . '</a>';
<!-- Second link, to get default text, around line 54 -->
echo '<a href="' . get_permalink() . '#comments' . '">Comments'. "($number)</a>";

Another thing, I’m making a site for Amadeus :)

Ehm… what was I thinking: “serene”? I’ve been playing Painkiller which is quite a hectic game. I’ve slaughtered hell’s boogers that attack me in hordes. Not even close to serene! Oh, and while I was making the header image + design for the Ami site, the computer suddenly shut down and I found out that a safety fuse had blown out. The fridge and oven in our kitchen were without electricity as well as our neighbour’s kitchen. Oh, and don’t forget our computers.

Despite the boogers (I know booger is the stuff that comes out of one’s nose, so?), or because of them, Painkiller is a very nice game. Somber. Nicely gruesome. I was a bit worried how it’d play on Simon because the minimum specs was 1,5 Ghz and I have 1,4. The game runs like a charm, however, and I didn’t even have to lower the performance settings. The graphics are amazing! A starry sky at the cemetary is very beautiful — until the skeletons attack.

The game is so hectic that I can’t play it for long without starting to feel a bit of motion sickness or something. Maybe I should lower the head bob setting.

Fingers crossed

I’m trying out — once again — Alex King’s Since Last Visit hack which should show how many new posts and comments there are since your last visit. I never got it working properly before, and the Javascript code never appeared in my source code, but now I nicked the code off another site using the hack and pasted it straight into the index page. Hopefully it’ll start working now.

@ 23:06

Ah, this is even better, a non-JavaScript version of the hack!!

<del>What</del> is <code>going on</code>?

My member page on the WordPress forums looks interesting because I’ve replied to posts that have tags in their titles. So there are lines that have a line through which annoy me more than the one line that has monospaced font.

I’ve noticed that I’m extremely allergic to the sound of a Jew’s harp (munniharppu in Finnish), someone “plays” it often around here and it just drives me up the wall. (uhhhh… speak of the devil)

Everything changes

I added a nice External links plugin that adds a cross-browser compliant (that is, works also in IE) icon after the external links. Because of that I’m removing the target=”_blank” from all the links.

Mutating menu

I’m making my right-hand side menu a Tabbed one. The idea behind it is that I can put context-dependent links (subcategories when on a category page, dates when in monthly archive, all static pages when on a static page, or something like that). There aren’t any of those yet, maybe I’ll have time to tweak that during the weekend (although I’m translating a paper for Dad — well, I won’t be doing that in the evening I think). Yup, that’s all.

Show all sesame!

I suddenly noticed the admin’s post editing page doesn’t show all the posts. It stupidly is affected by the number of posts shown on the blog’s index page which certainly isn’t the way it should be.

On the WordPress forums I could find some old posts on the subject and a person there said he would post a patch when he gets around checking it.

Well, I tried his idea (copy-pasting a code snippet from post.php to edit.php to reset some variables) but I couldn’t get it working. So, I made an “unprofessional” patch.

I haven’t had more than 50 posts per month (that’s how the posts are categorized) so I added a variable to show 50 posts “per page” (there aren’t any pages, really). This is at the very top of edit.php:

<?php
require_once('../wp-includes/wp-l10n.php');
$title = __('Posts');
require_once('admin-header.php');
$showposts=50;
?>

As the forum posts suggested, you might have to do something about the edit-comments.php too, but I have exactly 10 comments so far so I don’t know if all of the comments will show.

Category and archive droppings

In the attempt to shorten the menu, I decided to put the lists of monthly archives and categories into drop down menus. I just realized that in time they will (at least the monthly archives) get longer and longer and longer…

So, my first problem was that I’ve made a hidden category for static pages and it would show on the menu if I used WP’s built-in dropdown_cats tag.

Luckily, Ria at Typed by has made a Drop Down Cats Plugin with ability to exclude. What’s nice about it is that it a) formats subcategories differently from parents (indented with a hyphen), and b) it includes a post count parameter.

Archive tag (wp_get_archives) has an option to format the list of archives as an option list. You just need to build a drop-down menu function around it. Thus, as found at the WordPress forums
(remove the spaces after dots in “window.location=” if you’re going to cut-and-paste that — I needed to separate the words because it wouldn’t wrap nicely)

<form name="archiveform" action="">
  <select name="monthly_arch" onchange="window.location = (document. forms. archiveform. monthly_arch[document. forms. archiveform. monthly_arch. selectedIndex].value);">
    <option selected>Monthly archives</option>
    <?php wp_get_archives('type=monthly&format=option'); ?>
  </select>
</form>

It includes a little JavaScript, but I don’t know if that can be avoided. I’m disappointed to notice that formatting the archives as options is not compatible with showing the post count.
But
In the same thread there was a solution to that too. It involves a little tweaking (or correcting…) in template-functions-general.php, function get_archives_link around line 180, changing

else if ('option' == $format) {
return '<option value="'.$url.'">'.$text.'</option>'."\n";

to

else if ('option' == $format) {
return '<option value="'.$url.'">'.$text.$after.'</option>'."\n";

Introduction to categories

I wanted to add an introduction text to category pages. I already had a nice looking introduction text to the blog which only shows on the main page, so I thought I’d put the category descriptions in a similar box.

<!-- don’t show on a post’s page or monthly archives -->
<?php if (!$single && !$monthnum) { ?>
  <div id="intro">
    <!-- don’t show on category pages, either -->
    <?php if(!$cat) { ?>
      < Blog introduction >
    <?php } ?>
    <!-- show on category pages -->
    <?php if ($cat) { ?>
      <!-- single_cat_title(prefix,display) displays (with ‘true’ parameter) the category title -->
      <h1><?php single_cat_title('',true); ?></h1>
      <!-- category_description() alone doesn’t display it, that’s why you need to have the ‘echo’ there -->
      <p><?php echo category_description(); ?></p>
    <?php } ?>
  </div>
<?php } ?>

I’ve been spammed!

I got my first comment spam today (3 messages)!! Probably because my url is in my profile at WordPress forums, but oh well. They were all moderated, though. Soon I’ll be installing all kinds of spamihilators…

Very cool comment links for no one to click!

I installed the brand new Per Post Comment text plugin. Now I can have any kind of text for the comment link instead of the “boring” Comment?. Very nice.

Oh, dammit. Of course, cause the information is stored in the Custom fields, they will show before the post because I have other kinds of custom fields that need to show…

Thinking if I should make a category for WP… I think I should.

[edit: Nov 11] Had to remove the nice comment links because I wanted to try Alex King’s Since Last Visit plugin (indicates new posts and comments with a tiny image) — couldn’t get this to work. [/edit]
[edit: Nov 18] Installed Get Custom Field Values from Coffee2Code, so now I can choose which custom fields to show and which can be used as actual meta data. So, Per Post Comment text is activated again. [/edit]