Skip to content

Instantly share code, notes, and snippets.

@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' );
@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">
<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 / 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
),
@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">
<?php
// Seach WP posts per page
add_filter('searchwp_posts_per_page', function($posts_per_page, $engine, $terms, $page) {
return 20;
}, 99, 4);
<?php
if (!is_user_logged_in()) {
if (!in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
if ( isset( $_REQUEST['swpnonce'] ) || isset( $_REQUEST['swppurge'] ) ) {
//Indexer
} else {
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ( wp_redirect(wp_login_url($actual_link)) ) {
exit;
<?php
/**
* Template Name: search-events-nodates
*
* This is template will display a login form
*/
add_action('get_header', 'ck_do_login_form');
// Début de page pour supprimer les commentaires présents sur les pages par défault
<?php
/**
* The default template for displaying content
*
* Used for both single and index/archive/search
*
* @package Catch Themes
* @subpackage Clean Journal
* @since Clean Journal 0.1
*/
<?php
/**
* Template Name: Newsroom
*
* @package becketfund
*/
global $post;
// retrieve our search query if applicable .