Plugin Directory

source: subpage-view/trunk/subpage-view.php @ 101122

Last change on this file since 101122 was 101122, checked in by codework, 17 years ago
File size: 2.3 KB
Line 
1<?php
2/*
3PLUGIN NAME: Subpage View
4Plugin URI: http://wordpress.org/extend/plugins/subpage-view/
5DESCRIPTION: A plugin for showing subpages on a given page. Insert into MCE by using <code>[subpage-view <em>attributes</em>]</code> an example <code>[subpage-view depth="1"]</code>. View <a href="http://codex.wordpress.org/Template_Tags/wp_list_pages">WordPress Codex</a> for shortcode help. A CodeWork plugin for WordPress.
6AUTHOR: Henrik Urlund
7AUTHOR URI: http://codework.dk/referencer/wp-plugins/
8VERSION: 0.1.0
9*/
10
11/*  Copyright 2007-2009 Henrik Urlund (email: henrik at codework.dk)
12
13    This program is free software; you can redistribute it and/or modify
14    it under the terms of the GNU General Public License as published by
15    the Free Software Foundation; either version 2 of the License, or
16    (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21    GNU General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26*/
27
28class subpage_view
29{
30        function __construct()
31        {
32                add_shortcode('subpage-view', array(&$this, 'subpage_view'));
33        }
34       
35        function subpage_view($atts)
36        {
37                global $wp_query;
38                extract(shortcode_atts(array(
39                        'depth' => 0,
40                        'show_date' => '',
41                        'date_format' => get_option('date_format'),
42                        'child_of' => $wp_query->queried_object->ID,
43                        'exclude' => 0,
44                        'title_li' => '',
45                        'authors' => '',
46                        'sort_column' => 'menu_order, post_title',
47                        'link_before' => '',
48                        'link_after' => '',
49                        'exclude_tree' => ''
50                ), $atts));
51               
52                $children = wp_list_pages('depth='. $depth .'&show_date='. $show_date .'&date_format='. $date_format .'&child_of='. $child_of .'&exclude='. $exclude .'&title_li='. $title_li .'&echo=0&authors='. $authors .'&sort_column='. $sort_column .'&link_before='. $link_before .'&link_after='. $link_after .'&exclude_tree='. $exclude_tree);
53               
54                if ($children)
55                        return '<ul>'. $children .'</ul>';
56                else
57                        return '';
58        }
59}
60
61$subpage_view = new subpage_view();
62?>
Note: See TracBrowser for help on using the repository browser.