Skip to content

Instantly share code, notes, and snippets.

View vyskoczilova's full-sized avatar

Karolína Vyskočilová vyskoczilova

View GitHub Profile
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@hakre
hakre / DomTree.php
Last active February 22, 2021 11:40
DomTree - Dump DomDocument based documents, suiting debugging needs
<?php
/**
* DomTree
*
* Dump DomDocument based documents, suiting debugging needs
*
* @author hakre <http://hakre.wordpress.com/>
* @link http://stackoverflow.com/questions/26321597/getting-price-from-amazon-with-xpath/26323824#26323824
* @link http://stackoverflow.com/questions/12108324/how-to-get-a-raw-from-a-domnodelist/12108732#12108732
* @link http://stackoverflow.com/questions/684227/debug-a-domdocument-object-in-php/8631974#8631974
@brenna
brenna / wp-autopopulate-taxonomy
Last active December 26, 2022 23:29
WordPress function to auto-populate a taxonomy with a custom post type's entries.
function custom_tax_init(){
//set some options for our new custom taxonomy
$args = array(
'label' => __( 'My Custom Taxonomy' ),
'hierarchical' => true,
'capabilities' => array(
// allow anyone editing posts to assign terms
'assign_terms' => 'edit_posts',
/* but you probably don't want anyone
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@stevegrunwell
stevegrunwell / gist:8578709
Created January 23, 2014 13:51
(Quick and dirty) modification of http://stevegrunwell.com/blog/woocommerce-restrict-shipping/ to help Katie from http://noizepro.com/ with limiting WooCommerce shipping for two shipping methods.
<?php
/**
* Return an array of restricted shipping locations for WooCommerce
*
* Restricted locations include Alaska, American Samoa, Guam, Hawaii, North Mariana Islands, Puerto Rico,
* US Minor Outlying Islands, and the US Virgin Islands
*
* @return array
*/
@tangrufus
tangrufus / settings-api-tabs-demo.php
Created July 26, 2014 07:58
Adding Tabs with Settings API
<?php
/*
* Plugin Name: Settings API Tabs Demo
* Plugin URI: http://theme.fm/?p=
* Description: This is a demo showing off usage of tabs with the WordPress Settings API
* Version: 1.0
* Author: kovshenin
* Author URI: http://theme.fm
* License: GPL2
*/
@RadGH
RadGH / woocommerce-custom-cart-item-data.php
Last active November 16, 2023 15:16
Get and set custom cart item/product information prior to WooCommerce checkout, and carry those valus over to Order Item Metadata.
<?php
// UPDATE: Stefan from Stack Overflow has explained a better way to handle cart item data.
// See http://stackoverflow.com/a/32327810/470480
// ----------------------
/*
Instructions:
@ChromeOrange
ChromeOrange / gist:3cb3a16a6560795b972d
Created September 18, 2014 00:20
Add custom order status to WooCommerce 2.2, add to theme functions.php
/**
* Add custom status to order list
*/
add_action( 'init', 'register_custom_post_status', 10 );
function register_custom_post_status() {
register_post_status( 'wc-backorder', array(
'label' => _x( 'Back Order', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
@srikat
srikat / dd-menu-toggle.js
Last active August 29, 2015 14:07
How to display WordPress menu in a custom dropdown. http://sridharkatakam.com/display-wordpress-menu-custom-dropdown/
jQuery(function( $ ){
$( '.dd-button' ).click( function( e ) {
e.preventDefault();
var list = $('.dd-holder ul.menu');
if( list.hasClass( "opened" ) ) {
// list.hide();
list.slideToggle();
@jlengstorf
jlengstorf / README.md
Created October 8, 2014 20:28
Adds responsive embedding to WordPress oEmbed content.

Responsive Embeds in WordPress

This snippet filters oEmbed output in WordPress (the_content()) to force responsive embeds.

Usage

To use, add the contents of responseive_embeds.less to your site's stylesheet (if you're not using LESS, don't forget to move the iframe,object,embed rule outside of .embed-container and change it to .embed-container iframe,.embed-container object,.embed-container embed).

Then add the responsive_embed() function to your theme's functions.php and insert the add_filter() call in your theme's setup function.