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
[miniloop number_posts=2] | |
<li> | |
<h2>{title}</h2> | |
{image from=thumb width=75 height=75 class=alignleft}{ml_excerpt wlength=35 up_to_more=1 after=More... space_between=1}</li> | |
[/miniloop] |
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 | |
echo '<p>' . __('This is some text that needs to be translatable in my WordPress plugin', 'myplugin') . '</p>'; |
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
/* Add the following CSS rules to ~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css */ | |
/* Hide Google Mail Ads and right hand panel */ | |
td.y3 { display: none; } |
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 | |
if ( wp_is_mobile() ) { | |
// Visitor is on a mobile device | |
} else { | |
// Visitor is on a desktop (not mobile) device | |
} | |
?> |
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 | |
$attachment_id = attachment_url_to_postid( 'http://yourdomain.com/wp-content/uploads/myfile.pdf' ); | |
if ( $attachment_id ) { | |
// This file was found in the WordPress media library | |
// In this example we are going to permanently delete this file from the WordPress media library. | |
// Please be careful if you are copying/pasting this example code! | |
wp_delete_attachment( $attachment_id, true ); |
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 the product's short description (excerpt) to the WooCommerce shop/category pages. The description displays after the product's name, but before the product's price. | |
* | |
* Ref: https://gist.github.com/om4james/9883140 | |
* | |
* Put this snippet into a child theme's functions.php file | |
*/ | |
function woocommerce_after_shop_loop_item_title_short_description() { | |
global $product; |
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 | |
/** | |
* Rename WooCommmerce's "Sort Code" to "BSB". Useful for Australian stores | |
* Ref: https://gist.github.com/om4james/9885791 | |
*/ | |
function woocommerce_sort_code_rename_to_bsb($translation, $text, $domain) { | |
if ($domain == 'woocommerce') { | |
switch ($text) { | |
case 'Sort Code': | |
$translation = 'BSB'; |
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 | |
/** | |
* Allow the .4w7 file type to be uploaded to the WordPress media library. | |
* | |
* Ref: https://gist.github.com/om4james/9927208 | |
* | |
* Put this snippet into a child theme's functions.php file | |
*/ | |
function rasq_myme_types( $mime_types ){ | |
$mime_types['4w7'] = 'application/octet-stream'; |
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 | |
/** | |
* Shop/archives: wrap the product image/thumbnail in a div. | |
* | |
* The product image itself is hooked in at priority 10 using woocommerce_template_loop_product_thumbnail(), | |
* so priority 9 and 11 are used to open and close the div. | |
*/ | |
add_action( 'woocommerce_before_shop_loop_item_title', function(){ | |
echo '<div class="imagewrapper">'; |
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 | |
/** | |
* Archives: wrap the category/subcategory image/thumbnail in a div. | |
* | |
* The category image itself is hooked in at priority 10 using woocommerce_subcategory_thumbnail(), | |
* so priority 9 and 11 are used to open and close the div. | |
*/ | |
add_action( 'woocommerce_before_subcategory_title', function(){ | |
echo '<div class="imagewrapper">'; |
OlderNewer