Skip to content

Instantly share code, notes, and snippets.

View sky4git's full-sized avatar

Sky4git sky4git

  • Melbourne, Australia
View GitHub Profile
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
// Shop page id by woocommerce function
$shop_page_id = wc_get_page_id( 'shop' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
@sky4git
sky4git / .gitignore
Last active August 29, 2015 14:25 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@sky4git
sky4git / README.md
Last active August 29, 2015 14:25 — forked from limzykenneth/README.md

Deploy your site with git securely

This gist assumes:

  • you have a local git repo
  • you have an online remote repository (github)
  • you have a server running Apache with git already installed

you should be able to do the same with Java, Perl, RoR, JSP etc. however you'll need to recreate the (rather simple) PHP script

// Remove WooCommerce Theme Support admin message
add_theme_support( 'woocommerce' );
@sky4git
sky4git / woocommerce.php
Created June 6, 2015 02:30
Hide Shop page title woocommerce
add_filter( 'woocommerce_show_page_title' , 'woo_hide_page_title' );
/**
* woo_hide_page_title
*
* Removes the "shop" title on the main shop page
*
* @access public
* @since 1.0
* @return void
@sky4git
sky4git / async-wordpress-js.php
Last active August 29, 2015 14:21
Async Wordpress Scripts
// Note: This filter can go into functions.php
function add_defer_to_wp( $url )
{
if ( FALSE === strpos( $url, '.js' ) )
{ // not our file
return $url;
}
// Must be a ', not "!
return "$url' async";
}
@sky4git
sky4git / theme-meta.php
Created May 18, 2015 12:27
Option tee add meta boxes to page template
// ref: http://themeforest.net/forums/thread/option-tree-metabox-and-page-templates/75063
$post_id = (isset($_GET['post'])) ? $_GET['post'] : ((isset($_POST['post_ID'])) ? $_POST['post_ID'] : false);
if ($post_id) :
$post_template = get_post_meta($post_id, '_wp_page_template', true);
if ($post_template == 'template-home.php') ot_register_meta_box($my_meta_box);
endif;
@sky4git
sky4git / add_buttons_to_tinymce.js
Created December 22, 2014 06:19
Add button(s) to TinyMCE 4.x in Wordpress 4.x
( function() {
tinymce.PluginManager.add( 'dqshortcodes', function( editor, url ) {
console.log(url);
// Add a button that opens a window
editor.addButton( 'showrecent', {
text: 'Recent posts',
icon: false,
onclick: function() {
// Open window