Skip to content

Instantly share code, notes, and snippets.

@jprieton
jprieton / wp-query-ref.php
Created August 8, 2016 19:52 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?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(
@jprieton
jprieton / .htaccess
Last active January 28, 2016 14:02 — forked from felipepodesta/.htaccess
# ----------------------------------------------------------------------
# WORDPRESS HTACCESS FIREWALL
# @ http://codex.wordpress.org/Hardening_WordPress
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# DISABLE DIRECTORY BROWSING
# ----------------------------------------------------------------------
Options All -Indexes
<?php
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start();
?>
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
<?php
@jprieton
jprieton / custom-post-type-archive-menu-links.php
Last active August 29, 2015 14:13 — forked from davidmh/custom-post-type-archive-menu-links.php
Adds Custom Post Type archives to the WordPress-powered menus. Compatible with WP 4
<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.2
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2
// verify that this is a product category page
if (is_product_category()){
global $wp_query;
// get the query object
$cat = $wp_query->get_queried_object();
// get the thumbnail id user the term_id
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
// get the image URL
$image = wp_get_attachment_url( $thumbnail_id );
// print the IMG HTML