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
# 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 |
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 | |
// They could be pa_color, pa_flavor, pa_scent, it all depends how you named your product attribute | |
// all attributes are formated with the prefix pa_ *then your attrbute name* | |
// get the current product object to get the pa_size attributes, these might differ. | |
global $product; | |
// grab an array of product "size" attributes | |
$_sizes = wc_get_product_terms( $product->id, 'pa_size', array( 'fields' => 'names' ) ); |
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 | |
/* | |
Cleaner Code | |
*/ | |
// a psudeo array of images for testing | |
$items = array( | |
'https://s-media-cache-ak0.pinimg.com/236x/77/85/a1/7785a1b13a780842309579574715c35c.jpg', | |
'https://s-media-cache-ak0.pinimg.com/236x/77/85/a1/7785a1b13a780842309579574715c35c.jpg', | |
'https://s-media-cache-ak0.pinimg.com/236x/77/85/a1/7785a1b13a780842309579574715c35c.jpg', | |
'https://s-media-cache-ak0.pinimg.com/236x/77/85/a1/7785a1b13a780842309579574715c35c.jpg', |
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 | |
/* | |
Instructions: | |
1) Save data when adding to cart | |
When adding an item to your cart, use ld_woo_set_item_data. The best action for this to occur is | |
"woocommerce_add_to_cart". The first parameter for this action contains the "cart_item_key", | |
which is required for the function. |
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 | |
/* | |
NOT TOTALLY FUNCTIONAL - NOT TOTALLY FUNCTIONAL - NOT TOTALLY FUNCTIONAL - YOU MAY HAVE TO WORK IT INTO YOUR PROJECT DIFFERENTLY | |
*/ | |
add_action('admin_init', function(){ | |
if( isset( $_GET['di_export'] ) ) : | |
// post id = 177 // Collision Center |
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 | |
/* | |
* Plugin Name: Paulund WP List Table Example | |
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area | |
* Plugin URI: http://www.paulund.co.uk | |
* Author: Paul Underwood | |
* Author URI: http://www.paulund.co.uk | |
* Version: 1.0 | |
* License: GPL2 | |
*/ |
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_action('init', 'add_api_endpoint'); | |
function add_api_endpoint() | |
{ | |
/** | |
* Set up the endpoint URL my-api | |
* argument setup | |
* /my-api/v1/ | |
* |_ _my_api_key / _api_request / |
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 multilingual_post_creation(){ | |
global $sitepress; | |
/** | |
/** | |
Creating first post in english | |
*/ | |
//arguments for post creation | |
$def_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 | |
/** | |
* Custom Wordpress Query Page - Custom Permalinks | |
* @author Aaron Olin | |
*/ | |
if (! class_exists('CustomEndpoint')) { | |
class CustomEndpoint { | |
protected static $_instance = null; | |
protected $templateFile; | |
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 | |
$timestamp = '1517341140000'; | |
$post_arr = [ | |
'post_title' => 'Meh title', | |
'post_type' => 'post', //could be any custom post type | |
'post_content' => 'Meh body', | |
'post_category' => ['meh category'], | |
'post_status' => 'publish' |
OlderNewer