Created
November 6, 2011 13:17
-
-
Save billerickson/1342863 to your computer and use it in GitHub Desktop.
Display Posts Shortcode - comma separated list.
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
<?php | |
/** | |
* Customize opening outer markup of Display Posts Shortcode | |
* @author Bill Erickson | |
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/ | |
* | |
* @param $output string, the original opening markup | |
* @return $output string, the modified opening markup | |
*/ | |
function be_display_posts_open( $output ) { | |
$output = '<p class="post-listing">'; | |
return $output; | |
} | |
add_filter( 'display_posts_shortcode_wrapper_open', 'be_display_posts_open' ); | |
/** | |
* Customize closing outer markup of Display Posts Shortcode | |
* @author Bill Erickson | |
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/ | |
* | |
* @param $output string, the original closing markup | |
* @return $output string, the modified closing markup | |
*/ | |
function be_display_posts_close( $output ) { | |
$output = '</p>'; | |
return $output; | |
} | |
add_filter( 'display_posts_shortcode_wrapper_close', 'be_display_posts_close' ); | |
/** | |
* Comma separated links in Display Posts Shortcode plugin | |
* @author Bill Erickson | |
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/ | |
* | |
* @param string $output the original markup for an individual post | |
* @param array $atts all the attributes passed to the shortcode | |
* @param string $image the image part of the output | |
* @param string $title the title part of the output | |
* @param string $date the date part of the output | |
* @param string $excerpt the excerpt part of the output | |
* @param string $inner_wrapper what html element to wrap each post in (default is li) | |
* @return string $output the modified markup for an individual post | |
*/ | |
add_filter( 'display_posts_shortcode_output', 'be_display_posts_full_content', 10, 7 ); | |
function be_display_posts_full_content( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper ) { | |
// Rebuild the output | |
$output = '<span class="listing-item">' . $title . ', </span>'; | |
// Return the modified output | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment