Skip to content

Instantly share code, notes, and snippets.

<?php
$order = wc_get_order('18');
$items = $order->get_items();
foreach ( $order->get_items() as $item_id => $item ) {
// Here you get your data
$custom_field = wc_get_order_item_meta( $item_id, '_tmcartepo_data', true );
import React, { Component } from 'react';
import { Document, Page } from 'react-pdf';
import './App.css';
import './font-awesome-4.7.0/css/font-awesome.min.css';
//===================================================================================
//===================================================================================
jQuery(document).ready(function($) {
if (jQuery('body').hasClass('ie')){
alert('ie');
} else {
console.log('sub menu width');
jQuery('.sub-menu').each(function() {
var width = 10;
@BHWD
BHWD / rss_reader.php
Created August 13, 2018 20:03 — forked from mburst/rss_reader.php
RSS Feed Reader in PHP
<html>
<head>
<title>RSS Feed Reader</title>
</head>
<body>
<?php
//Feed URLs
$feeds = array(
"http://maxburstein.com/rss",
"http://www.engadget.com/rss.xml",
<?php
function new_us_simple_pdf_generate_cover_sheet( ) {
$postID = $_POST['postID'];
$siteRef1 = get_field('site_ref_1', $postID);
if (! class_exists ( 'TCPDF' )) {
require_once WP_PLUGIN_DIR . '/utility-search/pdf-gen/tcpdf_min/tcpdf.php';
}
if (! class_exists ( 'pdfheader' )) {
<?php
const UTILITY_SEARCH_POST_TYPE = "utility-search";
add_action("save_post_" . UTILITY_SEARCH_POST_TYPE, function ($post_ID, $post, $update) {
if (wp_is_post_autosave($post_ID)) {
return;
}
if (!$update) { // if new object
<?php
/**
* Set preffered countries for Caldera Forms phone fields
*/
add_filter( 'caldera_forms_phone_js_options', function( $options){
//Use ISO_3166-1_alpha-2 formatted country code
$options[ 'preferredCountries' ] = array( 'MX' );
return $options;
});
@BHWD
BHWD / is_tree.php
Last active September 29, 2017 11:35
<?php
/* Place this within the themes functions.php file */
function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if(is_page()&&($post->post_parent==$pid||is_page($pid)))
return true; // we're at the page or at a sub page
else
return false; // we're elsewhere
};
<?php
foreach( $order-> get_items() as $item_key => $item_values ):
$item_id = $item_values->get_id();
$item_name = $item_values->get_name(); // Name of the product
$item_type = $item_values->get_type(); // Type of the order item ("line_item")
$product_id = $item_values->get_product_id(); // the Product id
$wc_product = $item_values->get_product(); // the WC_Product object
$item_data = $item_values->get_data();
.col-xs-15,
.col-sm-15,
.col-md-15,
.col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
.col-xs-15 {