0

I'm very new to programming and not sure how to go about this. The following code returns 3 category names and feature images and then outputs them on the page.

<div id="footer">
    <div id="footer-inside">
        <div id="featured-categories-footer">
            <?php
                $featured_categories = array(8,9,10);
                foreach  ($featured_categories as $featured) {
                    if (get_option(THEME_PREFIX . 'enable_category_' . $featured)) {
                        echo '<!-- featured category #'.$count.' -->';
                        $category_id = get_option(THEME_PREFIX . 'featured_category_' . $featured); 
                        query_posts("cat=$category_id&showposts=1"); if (have_posts()) : while (have_posts()) : the_post(); ?>
                            <div class="featured-category-footer">
                                <a href="<?php echo get_category_link($category_id); ?>" title="View all posts in <?php echo get_cat_name($category_id); ?>">
                                    <?php the_post_thumbnail(); ?>
                                </a>

                                <h3><?php echo get_cat_name($category_id); ?></h3>
                                <?php echo category_description($category_id); ?>
                            </div>  
                        <?php
                        endwhile; endif; 
                        wp_reset_query();
                    }
                }
            ?>
        </div>

What I would like to do is, instead of it returning 3 categories that are specified in the admin area, I want to point to three static pages instead. So it will return the feature images for these 3 pages and also the name. Can anyone help please?

I think the line that needs to be changed is '$featured_categories = array(8,9,10);' to point to the pages instead. Am I on the right track here?

1 Answer 1

0

It seems like you are trying to change a theme to your own needs? Since you do not need the categories. etc. You could just drop that whole piece of code starting at

<?php     
   $featured_categories = array(8,9,10);

Until

  wp_reset_query();
                    }
                }
            ?>

Next put in your own html code. With links to your pages. Probably 3 times this.

<div class="featured-category-footer">
    <a href="link to page">link</a>
     <h3>title</h3>
</div>  

If you want these pages to come from your wordpress. Look into wp_list_pages and change it to your needs. http://codex.wordpress.org/Template_Tags/wp_list_pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.