Skip to content

Instantly share code, notes, and snippets.

@vimes1984
vimes1984 / gist:bd32e8a11f12aaece1d9
Created February 3, 2015 18:54
Client single after refactoring
<?php get_header(); ?>
<?php $user_ID = get_current_user_id(); ?>
<div ng-controller="singletype" ng-cloak>
<div class="col-md-8">
<?php
if( is_user_logged_in() ) {
while ( have_posts() ) : the_post();
//Default values
$pluginClass = ClientExchangePlugin::get_instance();
$checkresults = count( $wpdb->get_results( "SELECT ID FROM wp_watchlist WHERE watching = $post->ID AND userID = $user_ID" ) );
@vimes1984
vimes1984 / gist:57eaf57b35898b75ef92
Created February 3, 2015 18:56
Client before refacotring
<?php get_header(); ?>
<?php $user_ID = get_current_user_id(); ?>
<div id="content" ng-controller="singletype" class="<?php echo $content_class; ?>" style="<?php echo $content_css; ?>" ng-cloak>
<div class="avada-row" style="">
<div id="content" class="full-width">
<?php
if( is_user_logged_in() ) {
while ( have_posts() ) : the_post();
$checkresults = count( $wpdb->get_results( "SELECT ID FROM wp_watchlist WHERE watching = $post->ID AND userID = $user_ID" ) );
@vimes1984
vimes1984 / GA link clicker
Last active November 1, 2019 14:15
Track and push all a links for google anayltics
/**
* Retruns cat as buttons children for isotope loop
*/
function woocommerce_get_cat_children(){
if (is_product_category()) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$catID = $cat->term_id;
$taxonomy_name = "product_cat";
$termchildren = get_term_children( $catID, $taxonomy_name );
<?php
/**
* Edit post function endpoint
*/
function json_return(){
//Ok here we get the values postsed to this end point
$request_body = file_get_contents( 'php://input' );
$decodeit = json_decode( $request_body );
//return result to ajax call
<?php
/** Default values used later **/
//Sample items array
$items = array(
'item_one' => "value one",//simple string
'number' => 3,//Number
'multidimension' => array(
"sub_item_one" => "subvalue_one",
"sub_item_two" => "subvalue_two"
),//Multidimensional
@vimes1984
vimes1984 / Woocommerce product variable dynamic stock control
Last active March 18, 2021 23:19
Update product quantities dynamically, using woocommerce. Basically this question http://wordpress.stackexchange.com/questions/72662/woocommerce-fixed-quantity-of-a-product. If a product variation needs to update the total stock quantity say you seel packs of nails or packets of cigars or ml of a general litre stock...
<?php
/**
* GQ
*
* @package gq
* @author vimes1984 <[email protected]>
* @license GPL-2.0+
* @link http://buildawebdoctor.com
* @copyright 2-7-2015 BAWD
*/
@vimes1984
vimes1984 / contact form 7 to sales force
Last active September 20, 2016 00:22
this is an update to this function which is a little outdated now: http://daddyanalytics.com/integrating-contact-form-7-and-salesforce/
<?php
/**
* Sales force integration
*/
add_action( 'wpcf7_before_send_mail', 'my_conversion' );
function my_conversion( $cf7 ){
ob_start(); // start buffer capture
@vimes1984
vimes1984 / gist:8f206a6f48e50d2ae16a
Last active August 29, 2015 14:19
Mindbody api calls for cal
<?php
/**
*
*/
public function get_closed(){
if(isset( $_GET['start'] ) && !empty( $_GET['start'] )){
$StartClassDateTime = new DateTime($_GET['start']);
$EndClassDateTime = new DateTime($_GET['end']);
<?php
/**
* GQimport
*
* @package gqimport
* @author Vimes1984 <[email protected]>
* @license GPL-2.0+
* @link http://buildawebdoctor.com
* @copyright 6-28-2015 BAWD
*/