3 replies
I want to know what to change in the code below, to show actual id rather than the string value. The string value is .$azprstore_blogcat. and i want to show the category id's eg: 37,70,291,292

<?php if ($azprstore_blogfeature == "true") {query_posts($query_string . '&cat=-' .$azprstore_blogcat. '' ); } ?>
#code
  • Profile picture of the author bloodyuber
    hey mick this: $azprstore_blogcat is not a string value rather a variable that in php can be a string, an int, a double or any other object for that matter. it's a crap shoot when you don't have the source code in front of you because this isn't a known variable from some open source software. i would guess there is a variable named $azprstore_blogid or something like that.
    {{ DiscussionBoard.errors[6735413].message }}
  • Profile picture of the author ALicenseToCode
    So it looks like you're trying to manually display posts from certain category id's in wordpress?

    If you want to display just those categories you should change your code to this:

    <?php if ($azprstore_blogfeature == "true") {query_posts($query_string . '&cat=37,70,291,292' ); } ?>

    If you want to display all OTHER categories besides those, you should do this

    <?php if ($azprstore_blogfeature == "true") {query_posts($query_string . '&cat=-37,70,291,292' ); } ?>

    Notice the hypen after the equals sign (=-), you have that in your original example so I included both. Hope this helps!
    {{ DiscussionBoard.errors[6738786].message }}
  • Profile picture of the author brianng
    Just use $wpdb to reverse lookup for cat_id
    Keep it simple =)
    {{ DiscussionBoard.errors[6747479].message }}

Trending Topics