Skip to content

Instantly share code, notes, and snippets.

@billerickson

billerickson/gist:1270278

Last active Jan 4, 2019
Embed
What would you like to do?
Customize outer markup of Display Posts Shortcode
<?php
/**
* Customize opening outer markup of Display Posts Shortcode
* @see https://displayposts.com/2019/01/04/use-section-element-for-wrapper/
*
* @param $output string, the original opening markup
* @return $output string, the modified opening markup
*/
function be_display_posts_open( $output, $atts, $query ) {
$output = '<section class="display-posts-listing">';
return $output;
}
add_filter( 'display_posts_shortcode_wrapper_open', 'be_display_posts_open', 10, 3 );
/**
* Customize closing outer markup of Display Posts Shortcode
* @see https://displayposts.com/2019/01/04/use-section-element-for-wrapper/
*
* @param $output string, the original closing markup
* @return $output string, the modified closing markup
*/
function be_display_posts_close( $output, $atts, $query ) {
$output = '</section>';
return $output;
}
add_filter( 'display_posts_shortcode_wrapper_close', 'be_display_posts_close', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment