WordPress.org

Ready to get started?Download WordPress

Forums

Quick check of code sanity (2 posts)

  1. yanis
    Member
    Posted 8 years ago #

    All,

    I have the following call that worked a-ok in WP 1.5, that seems to fail to retrieve valid data under v 2.0 (yes I know it's not in general release yet), but someone might be able to spot the goof.

    Code snippet:

    <?php $sidenote_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'asides'"); ?>

    Under 1.5, that will (obviously) perform a valid mySQL lookup, under 2.0 it fails to actually generate any result (it's used before the_post loop). Is there anything new I need to add to ensure I'm making the right db calls?

    Cheers,
    Brendan.

  2. yanis
    Member
    Posted 8 years ago #

    Ok, I've cleaned up the mySQL call - which works..

    Apparently:

    <?php if ( in_category($sidenote_cat) ) { ?>

    .. doesn't return 'true' - even if the (category) result is actually true.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags