Last active
August 16, 2017 19:17
-
-
Save macbookandrew/62733a780899bb61773188641f4813de to your computer and use it in GitHub Desktop.
WP plugin: shortcodes to create faux archive pages for all custom Sermon Manager taxonomies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Sermon Manager Taxonomy Archives | |
* Plugin URI: https://gist.github.com/macbookandrew/62733a780899bb61773188641f4813de | |
* Description: Shortcode to create faux custom taxonomy archives; example: [sermon_tax_archive taxonomy="wpfc_preacher"] | |
* Version: 1.0.0 | |
* Author: AndrewRMinion Design | |
* Author URI: https://andrewrminion.com | |
* Copyright: 2017 AndrewRMinion Design | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License, version 2, as | |
* published by the Free Software Foundation. | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* You should have received a copy of the GNU General Public License | |
* along with this program; if not, write to the Free Software | |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
defined( 'ABSPATH' ) or die( 'No access allowed' ); | |
/** | |
* Show list of all terms in a given taxonomy | |
* @param array $atts shortcode parameters | |
* @return string HTML string | |
*/ | |
function wpfc_sermon_tax_archive( $attributes ) { | |
$shortcode_attributes = shortcode_atts( array ( | |
'taxonomy' => NULL, | |
), $attributes ); | |
return '<ul>' . wp_list_categories( array( | |
'echo' => false, | |
'taxonomy' => $shortcode_attributes['taxonomy'], | |
'title_li' => NULL, | |
)) . '</ul>'; | |
} | |
add_shortcode( 'sermon_tax_archive', 'wpfc_sermon_tax_archive' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment