Skip to content

Instantly share code, notes, and snippets.

@jchristopher
jchristopher / sidebar.php
Created June 20, 2017 20:43
Search WP document search
<?php if (is_search() && class_exists("SWP_Query") && isset($_GET["s"]) && $_GET["s"] !== ""):?>
<?php
$document_query = new SWP_Query(array(
"engine" => "my_engine_name",
"s" => $_GET["s"],
));
?>
<?php if (!empty($document_query->posts)): ?>
<nav class="content_menu-list_container menu-list_container">
@jchristopher
jchristopher / hs4588.php
Last active August 16, 2017 02:58 — forked from anonymous/Code 1
<?php
function hs4588_searchwp_live_search_configs( $configs ) {
$configs = array(
'default' => array( // 'default' config
'engine' => 'coach_chats', // search engine to use (if SearchWP is available)
'input' => array(
'delay' => 500, // wait 500ms before triggering a search
'min_chars' => 3, // wait for at least 3 characters before triggering a search
),
<form action="" method="get">
<p>
<input type="text" name="swpquery" id="swpquery" value="" data-swplive="true" value="<?php if ( isset( $_GET['swpquery'] ) ) { echo esc_attr( $_GET['swpquery'] ); } ?>" /> <!-- data-swplive="true" enables SearchWP Live Search -->
</p>
<p>
<button type="submit"><?php _e( 'Search' , 'mytextdomain' ); ?></button>
</p>
</form>
@jchristopher
jchristopher / gist:c1e084f8309934208863ffd6c506e782
Last active October 2, 2017 13:58 — forked from GitFrankie/gist:d797d706ccc2f1fb01c4ec17b3b3b568
search.php with SearchWP and Download Monitor
<?php get_header(); ?>
<!-- page content -->
<div class="pageWrap">
<div class="title-banner">
<div class="container">
<div class="mobile-wrap-page">
@jchristopher
jchristopher / retry-failed.php
Created July 6, 2023 10:08 — forked from ryanshoover/retry-failed.php
Action Scheduler retry failed jobs
<?php
// Instance of the batch processing job.
$job = MyBatchJob();
// How many failed attempts do you want to process.
$batch_max_attempts = 3;
add_action( 'action_scheduler_failed_execution', 'maybe_retry_failed_batch' );
add_action( 'action_scheduler_failed_action', 'maybe_retry_failed_batch' );