-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #3 - add bw_terms shortcode to display the taxonomy term list
- Loading branch information
1 parent
2d90b5e
commit bbae9a0
Showing
3 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php // (C) Copyright Bobbing Wide 2017 | ||
|
||
/** | ||
* Implements [bw_terms] shortcode | ||
* | ||
* The oik_a2z_display action echos the output | ||
* This is not what we want for a shortcode. | ||
* So we can either use output buffer logic or change the action.d | ||
* | ||
* @param array $atts shortcode parameters | ||
* @param string $content not expected | ||
* @param string $tag - shortcode tag | ||
* @return string generated HTML | ||
*/ | ||
function oik_a2z_terms( $atts, $content, $tag ) { | ||
$taxonomy = bw_array_get_from( $atts, "taxonomy,0", "letter" ); | ||
ob_start(); | ||
do_action( "oik_a2z_display", $taxonomy, $atts ); | ||
$contents = ob_get_contents(); | ||
ob_end_clean(); | ||
return( $contents ); | ||
} | ||
|
||
/** | ||
* Help hook for bw_terms | ||
*/ | ||
function bw_terms__help( $shortcode="bw_terms" ) { | ||
return( "Display taxonomy terms links" ); | ||
} | ||
|
||
|
||
/** | ||
* Syntax hook for bw_terms | ||
* | ||
* @TODO Do we need orderby and order parms? | ||
* | ||
*/ | ||
function bw_terms__syntax( $shortcode="bw_terms" ) { | ||
$syntax = array( "taxonomy" => bw_skv( "letter", "category|post_tag|<i>taxonomy_name</i>", "Taxonomy to display" ) | ||
, "count" => bw_skv( false, true, "Include term count" ) | ||
, "class" => bw_skv( "class", "<i>text</i>", "CSS class names" ) | ||
); | ||
return( $syntax ); | ||
} |