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 | |
add_action('phpmailer_init', 'phpmailerSMTP'); | |
/** | |
* @param \PHPMailer $phpmailer | |
*/ | |
function phpmailerSMTP($phpmailer) | |
{ | |
$phpmailer->IsSMTP(); |
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 | |
add_action('init', 'my_theme_init'); | |
function my_theme_init() { | |
if (!is_plugin_active()) { | |
return; | |
} | |
//do things here, plugin is active. |
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 | |
/* | |
* Generate xkcd style password from /usr/share/dict/words | |
* | |
* http://xkcd.com/936/ | |
* apt-get install wamerican | |
*/ | |
if (!function_exists('wp_generate_password')) : | |
$filesize = @filesize('/usr/share/dict/words'); | |
if ($filesize !== false): |
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
jQuery(function ($) { | |
var $mainContent = $('#main-content'), | |
$cat_links = $('.category-filters li a') | |
; | |
$cat_links.on('click', function (e) { | |
e.preventDefault(); | |
var $el = $(this), | |
value = $el.attr("href") | |
; |
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 insertPost( $post ) { | |
$wp_post = (array) $post; | |
$wp_postId = $wp_post['ID']; | |
unset($wp_post['ID']); | |
$wp_post['post_author'] = $this->user_id; | |
$wp_post['guid'] = str_replace( $baseUrl, $newUrl, $wp_post['guid'] ); |
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 | |
add_action('plugins_loaded', function() { | |
if (is_plugin_active($pluginFile) { | |
add_action('wp_head', function() { | |
echo '<style>/** correction for plugin **/ stupid.override { display: annoyed; }</style>'; | |
}); | |
}); | |
}) |
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 | |
spl_autoload_register( 'my_theme_autoloader' ); | |
function my_theme_autoloader( $class_name ) { | |
if ( substr( $class_name, 0, 6 ) == 'theme_' ) { | |
$cur_theme_file = get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . $class_name . '.php'; | |
$parent_theme_file = get_template_directory() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . $class_name . '.php'; | |
if ( file_exists( $cur_theme_file ) ) { | |
require_once $cur_theme_file; | |
} elseif ( file_exists( $parent_theme_file ) ) { |
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 | |
return [ | |
'version' => '1.0.0', | |
'table' => 'table_name', | |
'info' => [ | |
'item' => [ | |
'name' => 'cherry', | |
'value' => 'pick' | |
] |
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 | |
$email = new Input(); | |
$notEmptyEmailValidator = new NotEmpty(); | |
$notEmptyEmailValidator->setMessages([ | |
NotEmpty::INVALID => 'Please enter an Email Address', | |
NotEmpty::IS_EMPTY => 'Please enter an Email Address', | |
]); |
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 | |
$range = range(1, $rc); | |
$qs = implode(',', array_fill(0,$rc, '?')); | |
$titleQuery = $db->prepare('SELECT tablename_id, tablename_title, table_type, table_attribute FROM tablename WHERE tablename_id IN (' . $qs . ') ORDER BY tablename_title;'); | |
$titleQuery->execute($range); | |
$tableNames = $titleQuery->fetchAll(PDO::FETCH_ASSOC); | |
//$rc is a variable that stores the row count of the particular table | |
foreach($tableNames as $tablename_data) { | |