Skip to content

Instantly share code, notes, and snippets.

@davebonds
Created August 13, 2017 23:18
Show Gist options
  • Save davebonds/ee3346b8ea0c0cfea5596c42112d7675 to your computer and use it in GitHub Desktop.
Save davebonds/ee3346b8ea0c0cfea5596c42112d7675 to your computer and use it in GitHub Desktop.
Add support for webmention to Equity framework
<?php
add_action( 'equity_pings', 'equity_do_webmention' );
/**
* Echo Equity default webmention structure.
*
* Does the `equity_list_args` action.
*
* Applies the `equity_no_webmention_text` filter.
*
* @global WP_Query $wp_query Query object.
*
*/
function equity_do_webmention() {
global $wp_query;
//* If have webmention
if ( have_comments() && ! empty( $wp_query->comments_by_type['webmention'] ) ) {
equity_markup( array(
'html5' => '<div %s>',
'context' => 'entry-webmention',
) );
echo apply_filters( 'equity_title_webmention', __( '<h3>Webmentions</h3>', 'equity' ) ); // WPCS: sanitization ok.
echo '<ol class="webmention-list">';
do_action( 'equity_list_webmention' );
echo '</ol>';
echo '</div>';
} else {
echo apply_filters( 'equity_no_webmention_text', '' ); // WPCS: sanitization ok.
}
}
add_action( 'equity_list_webmention', 'equity_default_list_webmention' );
/**
* Output the list of webmentions.
*
* Applies the `equity_webmention_list_args` filter.
*/
function equity_default_list_webmention() {
$args = apply_filters( 'equity_webmention_list_args', array(
'type' => 'webmention',
) );
wp_list_comments( $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment