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 sku, author, publisher and format to product search | |
*/ | |
// hook into wp pre_get_posts | |
add_action('pre_get_posts', 'woo_search_pre_get_posts'); | |
/** | |
* Add custom join and where statements to product search query |
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 custom_shortcode_scripts() { | |
global $post; | |
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'myshortcode') ) { | |
wp_enqueue_script( 'my-script'); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'custom_shortcode_scripts'); |
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 your_prefix_detect_shortcode() { | |
global $wp_query; | |
$posts = $wp_query->posts; | |
$pattern = get_shortcode_regex(); | |
foreach ($posts as $post){ | |
if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) | |
&& array_key_exists( 2, $matches ) |
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 | |
class My_Shortcode { | |
static $add_script; | |
static function init() { | |
add_shortcode('myshortcode', array(__CLASS__, 'handle_shortcode')); | |
add_action('init', array(__CLASS__, 'register_script')); | |
add_action('wp_footer', array(__CLASS__, 'print_script')); | |
} | |
static function handle_shortcode($atts) { |
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 | |
class My_Shortcode { | |
function handle_shortcode( $atts, $content="" ) { | |
/* simply enqueue or print the scripts/styles in the shortcode itself */ | |
?> | |
<style type="text/css"> | |
</style> | |
<?php |
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
find ~/public_html -type f -iname "*.php" ! -iname "importbuddy.php" ! -iname "_repairbuddy.php" ! -iname "class-smtp.php" ! -iname "Excel5.php" ! -iname "OLERead.php"| xargs -i egrep -Hli '\@\$GLOBALS.*continue|GLOBALS.*x61|FbU73jxn|edE0lF|IGlmICgg|"1.sh"|GLOBALS.*ieetj84|rBOxlFeDa|rWmpisiBWQ|na20571|eval.*q272748|GET.*ineedthispage|x77.x69.x76|rWmyiJg3T|hacked\ by|eNqdWPtv|vd56b6998|filesman|Googleman|YYKJKaSZ.*\$_POST.*ppeRDsIfDuUi|5ebfbb39|c99shell|bar\/index|client.*x05.x01|POST.*do.*brut|img.*empty.*referrer|AtOPvMzpDq|5UpbRhpW|Qb08tTv2|ko0l|eval.stripslashes.array_pop\(\$_POST|www.*_POST.*yt.*ad.e|QGluaV9|doctoregpg|AnonGhost|AJVkA2M4om|an9dcW1i|PCT4BA6OD|aXNfdXBsb|zZ3HjuNg|E7DsuED2|DarkCrewFriends|zaprosname|HZBL02N|edoced|ZXZhbChiY|7X17f9rG' "{}" |
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 html($data) | |
{ | |
$html=implode("\r\n",array("%1html%3","%1head%3",head(),"%2head%3","%1body%3%sign%",body($data),"%2body%3","%2html%3")); | |
$html=preg_replace('/%1/',"<",$html);$html=preg_replace('/%2/',"</",$html);$html=preg_replace('/%3/',">",$html); | |
$sign=parag(1,1).(strlen($html)+31331);$html=preg_replace('/%sign%/',$sign,$html); | |
return $html; | |
} | |
function body($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 | |
$shortcode = '[gallery id="123"]' // Sample shortcode | |
preg_match_all( '/' . get_shortcode_regex() . '/s', $shortcode, $matches ); // | |
$out = array(); | |
if ( isset( $matches[2] ) ) { | |
foreach ( (array) $matches[2] as $key => $value ) { | |
if ( 'av_product_small_info' === $value ) { // Shortcode name | |
$out = shortcode_parse_atts( $matches[3][ $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 | |
global $post; | |
$post_id = $post->ID; // current post ID | |
$cat = get_the_category(); | |
$current_cat_id = $cat[0]->cat_ID; // current category ID | |
$args = array( | |
'category' => $current_cat_id, | |
'orderby' => 'post_date', | |
'order' => 'DESC' |