Skip to content

Instantly share code, notes, and snippets.

Jon Christopher jchristopher

Block or report user

Report or block jchristopher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jchristopher
jchristopher / gutenberg.html
Last active May 14, 2019
Sample of reusable block in Gutenberg
View gutenberg.html
<!-- wp:paragraph -->
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus
tincidunt nunc vel consequat dapibus. Pellentesque aliquet felis
nulla, sit amet efficitur mauris finibus in. </p>
<!-- /wp:paragraph -->
<!-- wp:block {"ref":50} /-->
<!-- wp:heading -->
<h2>Lipsum dolor sit</h2>
@jchristopher
jchristopher / gutenberg.html
Last active May 14, 2019
Sample of Gutenberg content in the database
View gutenberg.html
<!-- wp:paragraph -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tincidunt nunc vel
consequat dapibus. Pellentesque aliquet felis nulla, sit amet efficitur mauris
finibus in. </p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2>Lipsum dolor sit</h2>
<!-- /wp:heading -->
View functions.php
<?php
add_filter( 'searchwp_do_settings_backup', '__return_false' );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Tell SearchWP to use <span> for highlights instead of <mark>
View functions.php
<?php
// Tell SearchWP to use <span> for highlights instead of <mark>.
add_filter( 'searchwp_th_use_span', '__return_true' );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Prevent SearchWP's highlighter from stripping Shortcodes prior to highlighting
View functions.php
<?php
// Prevent SearchWP's highlighter from stripping Shortcodes prior to highlighting.
add_filter( 'searchwp_th_strip_shortcodes', '__return_false' );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Pre-process Custom Field content before it is sent to SearchWP's highlighter
View functions.php
<?php
// Pre-process Custom Field content before it is sent to SearchWP's highlighter.
add_filter( 'searchwp_th_pre_process_meta_value', function( $meta_value, $meta_key, $post_id ) {
// TODO: Customize $meta_value in any way you see fit.
return $meta_value;
}, 20, 3 );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Pre-process content before it is sent to SearchWP's highlighter
View functions.php
<?php
// Pre-process content before it is sent to SearchWP's highlighter.
add_filter( 'searchwp_th_pre_process_content', function( $content ) {
// TODO: Customize $content in any way you see fit.
return $content;
} );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Customize the 'password protected' message returned by SearchWP's highlighter
View functions.php
<?php
// Customize the 'password protected' message returned by SearchWP's highlighter.
add_filter( 'searchwp_th_password_required_message', function( $message ) {
return __( 'There is no excerpt because this is a protected post.' );
} );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Tell SearchWP to use partial matches when highlighting
View functions.php
<?php
// Tell SearchWP to use partial matches when highlighting.
add_filter( 'searchwp_th_partial_matches', '__return_true' );
@jchristopher
jchristopher / functions.php
Created Apr 26, 2019
Control the length of excerpts generated with SearchWP's highlighter
View functions.php
<?php
// When highlighting, tell SearchWP to generate excerpts that are 75 words long.
add_filter( 'searchwp_th_num_words', function( $length ) {
return 75;
} );
You can’t perform that action at this time.