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 | |
$locales = file_get_contents( 'https://api.wordpress.org/stats/locale/1.0/' ); | |
$locales = json_decode( $locales, true ); | |
arsort( $locales ); | |
$others = ''; | |
$index = 1; | |
foreach ( $locales as $locale => $value ) { | |
if ( 'Others' === $locale ) { | |
$others = $value; |
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 | |
set -euo pipefail | |
# define variáveis padrão para o BD (com possibilidade de receber de outro script) | |
DB_HOST="${DB_HOST:-127.0.0.1}" | |
DB_USER="${DB_USER:-root}" | |
DB_PASS="${DB_PASS:-root}" | |
if (( DOCKER_INST )); then | |
DIR_INSTALACAO= | |
WPCLI=$wp_docker |
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 | |
function submit_form_data( $confirmation, $form, $entry ) { | |
... | |
/** | |
* hold the form data that will be submitted to leap API | |
*/ | |
$leap_form_data = []; |
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 | |
// Exclude some terms form the ElasticPress Facets Widget Filter | |
add_action( | |
'pre_get_terms', | |
function ( $wp_term_query ) { | |
global $wp_query; | |
if ( ! $wp_query->get( 'ep_facet', false ) ) { | |
return false; | |
} |
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
UPDATE | |
`wp_postmeta` pm | |
SET meta_value = 1924905600 | |
WHERE meta_key IN | |
( | |
SELECT * FROM | |
( | |
SELECT REPLACE(meta_key, '_oembed_', '_oembed_time_') | |
FROM `wp_postmeta` | |
WHERE meta_key LIKE '_oembed_%' AND ( meta_value LIKE '%id="fb-root"%' OR meta_value LIKE '%class="instagram-media"%' ) |
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 | |
// Create a new field with product variation titles. | |
add_filter( | |
'ep_prepare_meta_data', | |
function( $post_meta, $post ) { | |
if ( 'product' !== get_post_type( $post ) ) { | |
return $post_meta; | |
} | |
|
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_filter( | |
'ep_weighting_configuration_for_search', | |
function( $weighting_config ) { | |
global $wpdb; | |
$post_meta = get_transient( 'custom_ep_distinct_post_meta' ); | |
if ( ! $post_meta ) { | |
$post_meta = $wpdb->get_col( | |
"SELECT DISTINCT meta_key |
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 | |
namespace TenUp_QueryLog; | |
function log_queries( $query ) { | |
if ( ! preg_match( '/^\s*(create|alter|truncate|drop|insert|delete|update|replace)\s/i', $query ) ) { | |
return $query; | |
} | |
// Not interested in any operations with transients |
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 a cross_field type clause to the ES query, so it searches for terms | |
* in different fields. | |
* | |
* @param array $query Current query | |
* @param array $args Query variables | |
* @param string $search_text Search text | |
* @param array $search_fields Search fields |