This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
// Add additional content to Custom Field during indexing in SearchWP. | |
add_filter( 'searchwp\source\post\attributes\meta', function( $meta_value, $args ) { | |
//error_log($args['meta_key']); | |
if ( 'searchwp_gtin' !== $args['meta_key'] ) { | |
return $meta_value; | |
} | |
error_log('gtin'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*pdf hide mobile notices*/ | |
.pdfemb-wantmobile, .pdfemb-wantmobile-fsarea { | |
display:none; | |
} | |
.pdfemb-pagescontainer { | |
top:31px !important; | |
} | |
.pdfemb-toolbar { | |
display:block !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"additionalModelInfo": {"type": "string", "description": "Information about the ethnicity and other facets of models in a model-released image."}, | |
"aperture": {"type": "string", "description": "The aperture (for example, 'f/2.8')."}, | |
"artist": {"type": "string", "description": "The artist's name."}, | |
"artworksShown": {"type": "table", "description": "A set of metadata about artwork or an object in the image. Each element in the table is a structure named ArtworkOrObjectDetails, as defined in the IPTC Extension spec."}, | |
"brightnessValue": {"type": "string", "description": "The brightness value."}, | |
"cameraMake": {"type": "string", "description": "The camera manufacturer."}, | |
"cameraModel": {"type": "string", "description": "The camera model."}, | |
"cameraSerialNumber": {"type": "string", "description": "The camera serial number."}, | |
"caption": {"type": "string", "description": "The caption for photo."}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"additionalModelInfo": {"type": "string", "description": "Information about the ethnicity and other facets of models in a model-released image."}, | |
"aperture": {"type": "string", "description": "The aperture (for example, 'f/2.8')."}, | |
"artist": {"type": "string", "description": "The artist's name."}, | |
"artworksShown": {"type": "table", "description": "A set of metadata about artwork or an object in the image. Each element in the table is a structure named ArtworkOrObjectDetails, as defined in the IPTC Extension spec."}, | |
"brightnessValue": {"type": "string", "description": "The brightness value."}, | |
"cameraMake": {"type": "string", "description": "The camera manufacturer."}, | |
"cameraModel": {"type": "string", "description": "The camera model."}, | |
"cameraSerialNumber": {"type": "string", "description": "The camera serial number."}, | |
"caption": {"type": "string", "description": "The caption for photo."}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem sourced from http://stackoverflow.com/questions/5273937/how-to-replace-substrings-in-windows-batch-file | |
setlocal enabledelayedexpansion | |
set INTEXTFILE=test.txt | |
set OUTTEXTFILE=test_out.txt | |
set SEARCHTEXT=bath | |
set REPLACETEXT=hello | |
set OUTPUTLINE= | |
for /f "tokens=1,* delims=¶" %%A in ( '"type %INTEXTFILE%"') do ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
currentAttempt=0 | |
totalAttempts=10 | |
delay=15 | |
while [ $currentAttempt -lt $totalAttempts ] | |
do | |
currentAttempt=$(( $currentAttempt + 1 )) | |
echo "Attempt $currentAttempt of $totalAttempts..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update(dl_url, force_update=False): | |
""" | |
Attempts to download the update url in order to find if an update is needed. | |
If an update is needed, the current script is backed up and the update is | |
saved in its place. | |
""" | |
import urllib | |
import re | |
from subprocess import call | |
def compare_versions(vA, vB): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allow partial regex pattern matches to be considered in SearchWP. | |
add_filter( 'searchwp\tokens\regex_patterns\only_full_matches', '__return_false' ); | |
// Enable regex pattern match tokenization in SearchWP. | |
add_filter( 'searchwp\tokens\tokenize_pattern_matches', '__return_true' ); | |
// Tell SearchWP to use a wildcard prefix when performing partial match logic. | |
add_filter( 'searchwp\query\partial_matches\wildcard_before', '__return_false' ); | |
// Tell SearchWP not to use a wildcard prefix when performing partial match logic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add WooCommerce Product (and Variation) SKUs to SearchWP. | |
// @link https://searchwp.com/documentation/knowledge-base/search-woocommerce-skus-and-variation-skus/ | |
add_filter( 'searchwp\entry\data', function( $data, \SearchWP\Entry $entry ) { | |
// If this is not a Product, there's nothing to do. | |
if ( 'product' !== get_post_type( $entry->get_id() ) ) { | |
return $data; | |
} | |
$my_extra_meta_key = 'searchwp_skus'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reduce SearchWP's minimum character length to 2 (default is 3). | |
add_filter( 'searchwp\tokens\minimum_length', function( $min ) { | |
return 2; | |
} ); | |
/*--------------------*/ | |
/* support for parent/child products*/ | |
/* -------------------*/ | |
add_filter( 'searchwp\query\tokens', function( $terms, $query ){ | |
$exact_match = get_posts( array( |
NewerOlder