Skip to content

Instantly share code, notes, and snippets.

View jimboobrien's full-sized avatar

Jimobrien jimboobrien

View GitHub Profile
@jimboobrien
jimboobrien / wp-template.php
Last active September 7, 2016 22:25
WordPress Template Hierarchy as of 4.4. If you want to exclude index.php make sure you have at least these files on the far right in your theme.
<?php
/* WordPress Template Hierarchy as of WordPress 4.4
is_404() ---------------------------------------------------------------------------------------------------> 404.php
is_search() ------------------------------------------------------------------------------------------------> search.php
is_front_page() --------------------------------------------------------------------------------------------> front-page.php
is_home() --------------------------------------------------------------------------------------------------> home.php
is_attachment() ---------> {mime_type}.php ------------> attachment.php ----------------\
is_single() -------------> single-{post_type}.php -----> single-{post_type}-{slug}.php --> single.php -----\
is_page() ---------------> page-{slug}.php ------------> page-{id}.php ------------------> page.php --------> singular.php
is_post_type_archive() --> archive-{post_type}.php ------------------------------------------------------\
@jimboobrien
jimboobrien / custom-woocommerce-order-report-system.php
Last active September 7, 2016 22:33
This is a page template for wordpress that displays woocommerce reports in a custom fashion for a venue that sells tickets.
<?php /*
Template Name: ORDERS Template
*/ ?>
<?php get_header(); ?>
<?php
global $wpdb;
?>
<?php
/*
Template Name: Sub-pages Template
*/
get_header();
global $more;
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); ?>
<?
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~PROPER WAY OF ADDING CHILD THEME CSS FILE ~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
$options = get_option('wpdc_options');
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>
<script>
var handler = StripeCheckout.configure({
key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
image: '/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
@jimboobrien
jimboobrien / charge.php
Last active March 12, 2017 21:09
This is a few code snippets that will make a custom form with variable amounts for the Stripe API. It sends a token safely to charge.php and then sends the data to both Stripe via API, but also sends the user an email address letting them know a transaction has been processed. The Customer data in Stripe can only be found in the Description. You…
<?php
try {
require_once('Stripe/lib/Stripe.php');
Stripe::setApiKey("sk_live_XXXXXXXXXXXXXXXXXXXXXXXX");
$token = $_POST['stripeToken'];
$form_amount = $_POST['payamount'];
$strName = $_POST["txtFormName"];
<?phpphp
/*
Template Name: Sitemap Template
*/
?>
<?php get_header(); ?>
<div class="container">
<!-- Example row of columns -->
/* fix pesky slider */
.et_pb_slides .et_pb_slide { min-height: 500px; }
@media only screen and (max-width: 980px) {
.et_pb_slides .et_pb_slide { min-height: 300px; }
}
/*****************************************************************************/
/**************VISIONQUEST WOOCOMMERCE CUSTOM FUNCTIONS***********************/
/******************************************************************************/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
<?php
/*
Template Name: Home Template
*/
?>
<?php get_header(); ?>
<section id="octane-video">