Desain Terletak pada Detailnya

Posted in Translation
0

This is the Indonesian language translation for A List Apart’s article Design is in the Details by Naz Hamid. Translated with the permission of A List Apart Magazine and the author[s].

Internet Explorer 8 beta 1 is Out

Posted in Asides
2

You can read the announcement here, or go straight to the download page this way.

Please note that installing the beta will overwrite your already installed IE (7, most likely), so you might want to think twice before doing it. There’s no standalone version / installation method available yet, but give it time. In the meanwhile, there are Virtual PC images with different version if IE available for free, so there’s an alternative.

List of Various Creative Ways of Using WordPress

Posted in Asides
0

I was about to make a blog post about this, but I’m really, really glad that Performancing did it first. It’s way more detailed than I could ever hope to make. Read 48 Unique Ways To Use WordPress at Performancing.com.

Will Somebody Fix Codex’s Search Functionality?

Posted in WordPress
2

Don’t you think it’s kind of weird that searching for “the_category” on WordPress Codex results in quite a lot of page, but none of it shows Template Tags/the category, the correct page for it?

I mean, the search term is also used on the correct page’s URL, so what’s the big deal here? Note that searching it via Google shows the correct page as the first result.

I frequently had some problems searching for various other things too. I love Codex, but sadly I must say the search functionality could use some help. What do you guys think?

Lorong Panjang

Posted in Translation
2

PS: This is the Indonesian language translation for A List Apart’s article The Long Hallway by Jonathan Follett. Translated with the permission of A List Apart Magazine and the author[s].

WordPress QuickTips: Getting a Post’s ID

Posted in WordPress
5

In a project I’m working on, I need to find the ID of a Post (a Page, actually, but the truth is that this works for both) so that the theme does not display the sidebar on this particular Post, but still showing for the rest.

At first I’m looking at the Template Tag the_ID(). Unfortunately, this function automatically prints out the Post’s ID instead of returning the ID when called. In other words, the following is not possible:

// Check whether the Post's ID is 5.
// This does not work.
if(the_ID()==5) do something...

…because the_ID() does not return 5. It turns out, the working method is by using $post->ID:

// Check whether the Post's ID is 5.
// This works.
if($post->ID == 5 ) do something...

Also, in my experience, the $post variable is still available after The Loop is done, very useful in my quest of displaying/hiding sidebar depending on the Post’s ID:

// This works.
<div id="content">

  // The Loop
  <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
       // ...the usual content displaying stuff...
    <?php endwhile; ?>
  <?php endif; ?>
</div>

<?php
  // Outside The Loop!
  if($post->ID != 21) get_sidebar(); ?>

I suppose this works well on template files that only display 1 content (e.g: single.php, page.php). Expect crazy things to happen when calling $post outside The Loop inside template files that actually loops more than once (index.php, category.php, etc).

Finding Query Count for a Certain Part in a WordPress Theme

Posted in WordPress
2

Michael Castilla’s post on modifying individual posts in the loop got me to test the query count between the double loop and single loop with counter method. This is my way to count that query count.

Say the Magic Word

This is how you would display the (current) query count in your theme:

<?php echo get_num_queries(); ?>

This piece of code is usually found inside footer.php, right at the very end of the code to display the total queries needed to display that single page. The secret is that you can place it just about anywhere inside your theme, and it will obediently display the total of query so far.

Also, you can have more than one of these in one go, so you could place one before and one after a certain part of a theme:

<?php echo get_num_queries(); ?>

The Loop here...

<?php echo get_num_queries(); ?>

…and you will have the query count before the loop and after it. Subtract the number and there you go, you have the total of queries invoked for The Loop.