WP_Screen
object returned by get_current_screen()
.
https://developer.wordpress.org/reference/functions/get_current_screen/
<?php
$current_screen = get_current_screen();
/** @var \WP_Screen $current_screen */
<?php | |
/** | |
* Plugin Name: Admin Bar User Switching Remove Port Number From Redirect URL | |
* Description: Removes the port number from the Admin Bar User Switching redirect URL, as the port number causes issues in Local By Flywheel running under HTTPS. | |
* Version: 0.1.0 | |
* Author: Richard Aber | |
* Author URI: https://richaber.com/ | |
*/ | |
add_filter( |
WP_Screen
object returned by get_current_screen()
.
https://developer.wordpress.org/reference/functions/get_current_screen/
<?php
$current_screen = get_current_screen();
/** @var \WP_Screen $current_screen */
<?php | |
// Function `parse_yturl()` from <http://stackoverflow.com/a/10524505/624466> | |
/** | |
* Check if the input string is a valid YouTube URL | |
* and try to extract the YouTube Video ID from it. | |
* | |
* @author Stephan Schmitz <[email protected]> | |
* @param $url string The string that shall be checked. |
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName | |
/** | |
* Plugin Name: RA Local Dev Plugin | |
* Description: Install as an mu-plugin to enable and disable other plugins during local development. | |
* Version: 0.1.0 | |
* License: GPL version 2 or any later version | |
* Author: Mark Jaquith, Andrey Savchenko, Paul Biron, Richard Aber | |
* | |
* Inspired by Paul Biron https://gist.github.com/pbiron/52bb63042cf220256ece89bc07fb57b0, |
<?php | |
/** | |
* This is a PHP script that is auto-added to Local's PHP Lightning Service php.ini's | |
* via auto_prepend_script to add relevant constants. | |
* | |
* @copyright Copyright (c) 2020, WP Engine | |
*/ | |
define( 'WP_ENVIRONMENT_TYPE', 'local' ); | |
function localwp_auto_login() { |
Algolia accepts the following values for the typoTolerance
setting (from the Algolia "Configuring Typo Tolerance" documentation):
true
: Activate typo-tolerance (default, suggested value).false
: Disable typo-tolerance.min
: Only keep results with the lowest number of typos. This means that if you have 1 or more records that match, you’ll only receive those records; but if you have no records that match, you’ll receive records with typo counts of 1 (or 2 if there are none with 1).strict
: Similar to 3, but keep the 2 lowest number of typos. This is useful when you want to ensure more results.WP Search with Algolia can be customized through the use of PHP filters, and customizing the autocomplete.php and instantsearch.php templates.
There is additional documentation about customizing index settin
First, make sure you have you read and followed the instructions for WPML integration found at https://community.algolia.com/wordpress/wpml.html
Following those instructions will ensure that the content itself has a wpml.locale attribute in the index for faceting, and will expose a window.current_locale
JS variable in the page, which you can use for further customization.
From there you should be able to customize the Algolia JS widgets in the autocomplete.php and instantsearch.php templates for your use case.
There is additional documentation about customizing those templates here https://community.algolia.com/wordpress/customize-autocomplete.html and here https://community.algolia.com/wordpress/customize-search-page.html.
The following example(s) extend what is described in the references above, to provide translations for the labels in the autocomplete drop down.
/** | |
* List unique CSS properties for all DOM elements | |
* Initially created to list unique font stacks on a page | |
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer} | |
* | |
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file} | |
* | |
* @author AndrewRMinion Design (https://andrewrminion.com) | |
* @version 1.1 | |
* |
<?php | |
$people = [ | |
[ | |
'name' => 'John Doe', | |
'email' => '[email protected]', | |
'occupation' => 'Software Developer', | |
], | |
[ | |
'name' => 'Jane Doe', |
Don't do this:
/**
* Enable SVG mime types.
*
* @param array $mimes Current allowed mime types.
* @return array Updated allowed mime types.
*/
function prfx_custom_mime_types( $mimes ) {