Visit the documentation and follow the instructions.
- Copy your API key, and add the following snippet to your
functions.php
.- Replace
YOUR_API_KEY
with your key you copied.
- Replace
<?php | |
/** | |
* Convert an object to an array. | |
* | |
* @param array $object The object to convert | |
* @return array The converted array | |
*/ | |
function object_to_array( $object ) { | |
if( !is_object( $object ) && !is_array( $object ) ) return $object; | |
return array_map( 'object_to_array', (array) $object ); |
/** | |
* Automatically resize input fields while typing | |
* | |
* Usage: $('input.autoresize').autoResizeInput({ minWidth: 250, comfortZone: 0 }); | |
*/ | |
(function($){ | |
$.fn.autoResizeInput = function(o) { | |
o = $.extend({ |
<?php | |
/** | |
* Remove the h1 tag from the WordPress editor. | |
* | |
* @param array $settings The array of editor settings | |
* @return array The modified edit settings | |
*/ | |
function remove_h1_from_editor( $settings ) { | |
$settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;'; | |
return $settings; |
.full-image { | |
position: relative; | |
left: calc(-50vw + 50%); | |
width: 100vw; | |
margin: 2rem 0; | |
img { | |
width: 100%; | |
} | |
} |
<?php | |
/** | |
* Prettify a range of dates. | |
* | |
* @param mixed $start The start date | |
* @param mixed $end The end date | |
* @param string $format A date() string for formatting if the dates match | |
* @param string $format_day A date() string for formatting if they are different days | |
* @param string $format_month A date() string for formatting if they are different months | |
* @param string $format_year A date() string for formatting if they are different years |
<?php | |
/** | |
* Prettify a range of times. | |
* | |
* @param mixed $start The start date, with time | |
* @param mixed $end The end date, with time | |
* @return string A prettified date() string for the time range | |
*/ | |
function get_pretty_time_range( $start='', $end='' ) { | |
$diff_meridiem = false; |
Visit the documentation and follow the instructions.
functions.php
.
YOUR_API_KEY
with your key you copied.<?php | |
/** | |
* Allow users to login to the site with their username or email. | |
* | |
* @param object $user WP_User object | |
* @param string $username_email The username or email entered for login | |
* @param string $password The users password | |
* @return object The authenticated WP_User object | |
*/ | |
function wp_allow_user_login_with_email( $user, $username_email, $password ) { |
<?php | |
/** | |
* Get a string between 2 strings. | |
* | |
* @param string $string The string to search | |
* @param string $start The string to start with | |
* @param string $end The string to end with | |
* @param boolean $case_sensitive Whether to make the search case sensitive or not | |
* @return string The string that was found between the start and end | |
*/ |
<?php | |
/** | |
* Remove empty values from an array. | |
* | |
* @param array $arr The array to remove values from | |
* @return array The new array without the empty values | |
*/ | |
function remove_empty_values( $arr ) { | |
if( ! is_array( $arr ) ) return $arr; |