Skip to content

Instantly share code, notes, and snippets.

Jon Christopher jchristopher

View GitHub Profile
View gist:c1e084f8309934208863ffd6c506e782
<?php get_header(); ?>
<!-- page content -->
<div class="pageWrap">
<div class="title-banner">
<div class="container">
<div class="mobile-wrap-page">
View hs4588.php
<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>
View hs4588.php
<?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 Jun 20, 2017
Search WP document search
View sidebar.php
<?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">
View functions.php
<?php
// Seach WP posts per page
add_filter('searchwp_posts_per_page', function($posts_per_page, $engine, $terms, $page) {
return 20;
}, 99, 4);
View functions.php
<?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;
View Search-events-nodates.php
<?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
View sez-content.php
<?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
*/
View template-newsroom.php
<?php
/**
* Template Name: Newsroom
*
* @package becketfund
*/
global $post;
// retrieve our search query if applicable .
View 3053.php
<?php
function my_searchwp_omit_meta_key( $omit, $meta_key, $the_post ) {
$url_meta = 'link-url';
$url_found = strpos( $meta_key, $url_meta );
// if "link-url" is in a custom field meta key name, do not index it
if ( false !== $url_found ) {
$omit = true;
}
You can’t perform that action at this time.