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
/* | |
* From css-tricks.com | |
* http://css-tricks.com/snippets/css/media-queries-for-standard-devices/ | |
*/ | |
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ |
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 | |
// link shortcode | |
function mainurl_function($atts) { | |
extract(shortcode_atts(array( | |
'text' => 'Text', | |
'url' => 'http://yourdomain.com', | |
), $atts)); | |
return '<a href="'. $url . '" class="contactlink" >'. $text . '</a>'; | |
} |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
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 ( is_single() ) { | |
$cats = get_the_category(); | |
$cat = $cats[0]; // let's just assume the post has one category | |
} | |
else { // category archives | |
$cat = get_category( get_query_var( 'cat' ) ); | |
} | |
$cat_id = $cat->cat_ID; |
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
//Search by product SKU in Admin Woocommerce Orders | |
add_filter( 'woocommerce_shop_order_search_fields', function ($search_fields ) { | |
$posts = get_posts(array('post_type' => 'shop_order')); | |
foreach ($posts as $post) { | |
$order_id = $post->ID; | |
$order = new WC_Order($order_id); | |
$items = $order->get_items(); | |
foreach($items as $item) { |
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; | |
$args = array( 'taxonomy' => 'product_cat',); | |
$terms = wp_get_post_terms($post->ID,'product_cat', $args); | |
$count = count($terms); | |
if ($count > 0) { | |
foreach ($terms as $term) { | |
echo '<div style="direction:rtl;">'; |
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
function return_terms_index() { | |
$taxonomies = array( | |
'taxonomy_name', | |
); | |
$args = array( | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => false, | |
'fields' => 'all', |
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 | |
// source: http://frankiejarrett.com/get-an-attachment-id-by-url-in-wordpress/ | |
$url = 'http://frankiejarrett.com/wp-content/uploads/2013/05/test-image.jpg'; | |
$attachment_id = fjarrett_get_attachment_id_by_url( $url ); | |
$path = ( $attachment_id ) ? get_attached_file( $attachment_id ) : null; | |
echo $path; | |
?> |
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 | |
// in the loop | |
$category = get_the_category(); | |
$currentcat = $category[0]->cat_ID; | |
$currentcatname = $category[0]->cat_name; | |
$currentcatslug = $category[0]->slug; | |
// outside the loop | |
global $post; | |
$categories = get_the_category($post->ID); |
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 | |
/** | |
* Count number of widgets in a sidebar | |
* Used to add classes to widget areas so widgets can be displayed one, two, three or four per row | |
* source: http://slobodanmanic.com/444/flexible-horizontal-sidebars-wordpress-twenty-thirteen-child-theme/ | |
*/ | |
function slbd_count_widgets( $sidebar_id ) { | |
// If loading from front page, consult $_wp_sidebars_widgets rather than options | |
// to see if wp_convert_widget_settings() has made manipulations in memory. |
OlderNewer