This file contains hidden or 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 get_excerpt($post) { | |
$excerpt = $post->post_excerpt; | |
if (empty($post->post_excerpt)) { | |
$_html = explode("\n", trim(strip_tags($post->post_content, '<p>'))); | |
$_html = array_filter($_html, function($var) { | |
return (is_int(stripos($var, '<p'))) ? true : false; | |
}); | |
$_html = array_values($_html); | |
if (!empty($_html)) { |
This file contains hidden or 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 | |
var_dump(get_defined_constants(true)); | |
$user_const = array( | |
'WP_USE_THEMES' => true, | |
'ABSPATH' => '/Users/currentusername/Sites/wordpress/', | |
'DB_NAME' => 'wordpress', | |
'DB_USER' => 'root', | |
'DB_PASSWORD' => 'root', | |
'DB_HOST' => 'localhost', |
This file contains hidden or 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
const electron = window.require('electron'); | |
const clipboard = electron.clipboard; | |
const crashReporter = electron.crashReporter; | |
const desktopCapturer = electron.desktopCapturer; | |
const ipcRenderer = electron.ipcRenderer; | |
const nativeImage = electron.nativeImage; | |
const remote = electron.remote; | |
const screen = electron.screen; | |
const shell = electron.shell; |
This file contains hidden or 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 | |
/** | |
* Image placeholder | |
* | |
* @param integer $width Placeholder width. | |
* @param integer $height Placeholder height. | |
* @param string $color Placeholder color. | |
* @return string Data ULR | |
*/ | |
function get_placeholder(int $width = 0, int $height = 0, string $color = 'transparent') { |
This file contains hidden or 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 | |
// Doc : https://stackoverflow.com/questions/43009398/custom-gravity-forms-field-with-multiple-inputs | |
class GF_Field_UTM extends GF_Field { | |
public $type = 'utm'; | |
private $fields_name = array( | |
'referrer', | |
'last_referrer', | |
'utm_campaign', |
This file contains hidden or 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
Order deny,allow | |
Allow from 192.168.1.1 | |
Deny from all | |
Satisfy any | |
AuthUserFile /path/to/.htpasswd | |
AuthType Basic | |
AuthName "My restricted Area" | |
Require valid-user |
This file contains hidden or 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 | |
/* ================================================================ | |
* Clean up functions | |
* Remove & clean all the stuff added by wordpress | |
* ================================================================ */ | |
/** | |
* WP Theme Clean Up | |
*/ | |
if (! function_exists('wp_theme_start_cleanup')) { |
This file contains hidden or 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 getImage ($image_id) { | |
if (!$image_id) { return null; } | |
$base_url = get_site_url().'/wp-content/uploads/'; | |
$sizes = get_intermediate_image_sizes(); | |
$image = array( | |
'meta' => array(), | |
'sizes' => array(), |
This file contains hidden or 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
function formatDateText(date_start, date_end) { | |
date_start = (date_start) ? new Date(date_start) : null; | |
date_end = (date_end) ? new Date(date_end) : null; | |
var date_text = ''; | |
var lang = 'fr-FR'; | |
if (!date_end) { | |
date_text = date_start.toLocaleDateString(lang, { | |
year: 'numeric', |
This file contains hidden or 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
function isMobile() { | |
if (function_exists('wp_is_mobile')) { | |
if (wp_is_mobile()) { | |
return true; | |
} else { | |
return false; | |
} | |
} else { | |
if (preg_match('/(android|webos|avantgo|iphone|ipad|ipod|blackberry|iemobile|bolt|boost|cricket|docomo|fone|hiptop|mini|opera mini|kitkat|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $_SERVER['HTTP_USER_AGENT'])) { |