Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Deano__28

    (@deano_28)

    Hi,

    I can’t seem to find an archive.php file anywhere, does the below look like the category/archive part you mentioned?

    I don’t really have anyone who can help at this point as the person who was now seems to be gone AWOL. That said if I can’t figure it out I will attempt to find someone else who could get it finished for me.

    Thanks for your help

    ‘<!– THE POST QUERY –>
    <!– This one’s special because it’ll look for our category filter and apply some magic –>

    <?php

    if(get_post_custom_values(‘category_filter’)) : // If the category filter exists on this page…

    $cats = get_post_custom_values(‘category_filter’); // Returns an array of cat-slugs from the custom field.

    foreach ( $cats as $cat ) {
    $catid = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE slug=’$cat'”); // Grab the cat-id from the DB using the category slug ($cat).
    $acats[] = $catid; // Turn the list of ID’s into an ARRAY, $acats[]
    }

    $cat_string = join(‘,’, $acats); // Join the ARRAY into a comma-separated STRING for use in query_posts
    //echo $cat_string; // Test

    endif; // End the situation… carry on as usual if there was no category filter.
    ?>

    <?php

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $args=array(
    ‘cat’=>$cat_string, // Query for the cat ID’s (because you can’t use multiple names or slugs… crazy WP!)
    ‘paged’=>$paged, // Basic pagination stuff.
    );
    query_posts($args); ?>’

Viewing 1 replies (of 1 total)