«

»

Aug
06
2008

Code Fix 101

Nothing kills your day (or night in some cases) quicker then spending a couple hours trying to track down solutions to coding problems. Especially when you’re not really an expert on the stuff you’re trying to cludge together. Since I learn most of my code-foo via reverse engineering, it takes me a bit longer to fix something when it goes wrong. I usually lack the fundamental understanding of the code I’m working with until I’m forced to dig into the code to fix it. Yea I know, it’s a somewhat back-asswards way of teaching yourself a new programming language but it works for me.

I knocked out two today – the first one involves a fix I’ve been working on for the last couple of weeks and the second was a 2 min quickie.

Fix #1
In a nut shell, apparently $query_post does not pass paging information into the main post loop so if you customize your post display using something like:

< ?php $query_post('cat=-1') ?>

You end up with a working post filter but broken page links. My [first $query_post fix failed] but after a couple more hours wading through Google searches, I stumbled across this:
[$query_post paging work-around].

Bingo. My thanks goes out to guys way smarter than me.

Fix #2
This one was easy. I noticed my quicktag

< --more-->

was being ignored by [WordPress] when it parsed my custom page templates. A quick Google search [gave me the solution]:

< ?php global $more; $more=0; the_content(); ?>

By declaring the global variable $more and turning it on with “0″ (“1″ is off), you force WP into parsing the [the_content()] template tag in conjunction with the quicktag.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>