Skip to content

Commit

Permalink
Adding Support for extra Jetpack features
Browse files Browse the repository at this point in the history
I added the following new features:

* Add support for Jetpack Omnisearch -
https://www.evernote.com/shard/s1/sh/9255d08a-e22f-4f8d-a923-49f99dbd6fc
5/42d7c8c439fb2400de78fa9690ff621e
* Improve basic copy for Jetpack Related Posts, instead of Related, it
now will say Similar Testimonials
* Added support for Jetpack Publicize and Markdown Editor support
  • Loading branch information
bhubbard committed Dec 26, 2014
1 parent 1bf9374 commit 2043d69
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions classes/class-woothemes-testimonials.php
Expand Up @@ -42,6 +42,10 @@ public function __construct( $file ) {

add_action( 'init', array( $this, 'register_post_type' ) );
add_action( 'init', array( $this, 'register_taxonomy' ) );
add_action( 'init', array( $this, 'support_jetpack_omnisearch' ) );

add_filter( 'jetpack_relatedposts_filter_headline', 'support_jetpack_relatedposts' );


if ( is_admin() ) {
global $pagenow;
Expand Down Expand Up @@ -103,7 +107,7 @@ public function register_post_type () {
'capability_type' => 'post',
'has_archive' => $archive_slug,
'hierarchical' => false,
'supports' => array( 'title', 'author' ,'editor', 'thumbnail', 'page-attributes' ),
'supports' => array( 'title', 'author' ,'editor', 'thumbnail', 'page-attributes', 'publicize', 'wpcom-markdown' ),
'menu_position' => 5,
'menu_icon' => ''
);
Expand Down Expand Up @@ -563,4 +567,30 @@ private function flush_rewrite_rules () {
public function ensure_post_thumbnails_support () {
if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
} // End ensure_post_thumbnails_support()
} // End Class

/**
* Add Testimonial Support to Jetpack Omnisearch
*/
public function support_jetpack_omnisearch() {
if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) {
new Jetpack_Omnisearch_Posts( 'testimonial' );
}
}

/**
* Better Jetpack Related Posts Support for Testimonials
*/
function support_jetpack_relatedposts( $headline ) {
if ( is_singular( 'testimonial' ) ) {
$headline = sprintf(
'<h3 class="jp-relatedposts-headline"><em>%s</em></h3>',
esc_html( 'Similar Testimonials' )
);
return $headline;
}
}

} // End Class



0 comments on commit 2043d69

Please sign in to comment.