PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
Template Name: Product Category    
*/
?>
    <?php get_header(); ?>
    <div id="top_buttons"><!~- Easiest Way --></div>
    <div id="column">
    <!-- LOOP -->
<?php if (have_posts()) : ?>
 
        <?php while (have_posts()) : the_post(); ?>
                <h2><?php
    function getParents($id) {
        global $wpdb;
        $posts_table = $wpdb->prefix . "posts";
        $parent_id = $wpdb->get_var("SELECT post_parent FROM $posts_table WHERE ID=$id");
        if($parent_id == 0) return;
        $parent = get_post($parent_id);
        return getParents($parent_id) . '<a href="'. get_permalink($parent_id) . 
            "\" title=\"$parent->post_title\">$parent->post_title</a> &gt; ";
    }
    ?>
                           > 
                           <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
 
        <!-- Display Subpages & Products -->
                <ul><?php 
                $children = get_children("post_type=page&post_parent=$post->ID");
                foreach ($children as $child)
                    echo '<li><a href="'. get_permalink($child->ID) . 
                        "\" title=\"$child->post_title\">$child->post_title</a></li>";
                ?></ul>
        <?php endwhile; ?>
        
    <?php else : ?>
    
        <h2>Not Found</h2>
        
        <p>Sorry, but you are looking for something that isn't here.</p>
        
    <?php endif; ?>
 
    </div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)