Skip to content

Instantly share code, notes, and snippets.

@stompweb
stompweb / add-event-ticket.php
Last active March 14, 2018 16:14
Add event ticket
<?php
$event_id = Tribe__Events__API::createEvent(
array(
'post_title' => $event['title'],
'post_status' => 'publish',
'EventStartDate' => $event['date'],
'EventEndDate' => $event['date'],
'EventStartHour' => $event['start'],
'EventStartMinute' => '00',
'EventEndHour' => $event['finish'],
@stompweb
stompweb / case-studies-users.php
Last active February 19, 2018 12:10
Case Studies - Users
<?php
function sj_rewrite_case_studies_users() {
hm_add_rewrite_rule(
array(
'regex' => '^case-studies/([^/]+)/?',
'query' => 'author_name=$matches[1]',
'template' => 'templates/your-template.php',
'title_callback' => function( $title, $seperator ) {
return get_query_var( 'author_name' ) . ' case studies ' . $seperator . ' ' . $title;
}
@stompweb
stompweb / product-list.php
Created December 13, 2017 10:15
Product List
<?php
object(stdClass)#5627 (26) {
["Qty"]=>
string(1) "0"
["Ccode"]=>
string(8) "22000001"
["Description"]=>
string(13) "One Child Tkt"
["TicketDescription"]=>
@stompweb
stompweb / response.php
Last active November 9, 2017 14:20
Response
<?php
object(SimpleXMLElement)#368 (1) {
["anyType"]=>
object(SimpleXMLElement)#356 (24) {
["AVAILABLE"]=>
string(2) "20"
["RESNAME"]=>
string(12) "SECOND EVENT"
["RESTYPE"]=>
@stompweb
stompweb / response.php
Last active November 3, 2017 14:01
API Response
<?php
object(SimpleXMLElement)#367 (1) {
["anyType"]=>
object(SimpleXMLElement)#359 (24) {
["AVAILABLE"]=>
string(2) "20"
["RESNAME"]=>
string(12) "SECOND EVENT"
["RESTYPE"]=>
@stompweb
stompweb / request.php
Created September 20, 2017 09:18
api-request.php
<?php
$string = '<?xml version="1.0"?>
<XMLRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Description>RESOURCELISTBYVIEWBYDATELOAD</Description> <Item xsi:type="XMLResourceByViewRangeRequest">
<ResStartDate>15/09/2017</ResStartDate><ResEndDate>15/10/2017</ResEndDate> <ResCode />
<ResView>Events</ResView> <EventCode /><ShowProductMap>false</ShowProductMap>
</Item></XMLRequest>';
$client = new SoapClient( 'http://10.1.0.16/GDXMLWebServiceTEST/GDXMLWebService.asmx?wsdl' );
<?php
/**
* The template for displaying product content within loops
*
* This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@stompweb
stompweb / category.php
Created July 13, 2017 11:52
Facet WP Category
<div class="row">
<div class="sort-by">
<div class="col-xs-7">
<div class="parent-link">
<?php
$current = get_queried_object();
$parent = get_term( $current->parent, $current->taxonomy ); ?>
<a href="<?php echo get_term_link( $parent ); ?>">
<?php
class Order {
public function __construct() {
// Setup Orders table
add_action('init', array( $this, 'setupOrderTable' ) );
// Create an order when a user completes the form
@stompweb
stompweb / redirectFlow.php
Created March 13, 2017 22:22
RedirectFlow
<?php
$redirectFlow = $client->redirectFlows()->complete(
'test',
["params" =>
["session_token" => 'test']
]
);