Skip to content

Instantly share code, notes, and snippets.

View spigotdesign's full-sized avatar

Bryan Hoffman spigotdesign

View GitHub Profile
<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->post_parent) ); ?>
@spigotdesign
spigotdesign / get-parent-page-title.php
Last active October 7, 2016 21:05
Get the title of the parent page; If no parent, show this page's title
<?php echo empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent ); ?>
@spigotdesign
spigotdesign / acf-get-image.php
Last active March 1, 2016 19:01
ACF Get Image snippets
<?php // Get Image url (for background) ?>
<?php $bgImage = esc_html(get_field('img_field')); ?>
<?php $bgURL = wp_get_attachment_image_src($bgImage, 'full'); ?>
<div class="bg" style="background-image: url(<?php echo $bgURL[0]; ?>);"></div>
<?php // Get Image attatchment (for full image output) ?>
<?php $bpImage = esc_html(get_field('img_field')); ?>
<?php echo wp_get_attachment_image($bpImage, 'full'); ?>
@spigotdesign
spigotdesign / wp-config.php
Created February 23, 2016 23:29
Turn on WordPress error reporting
// define('WP_DEBUG', false);
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
<?php include(locate_template('inc/my-snippet.php')); ?>
<?php get_template_part('inc/my', 'snippet'); ?>
@spigotdesign
spigotdesign / get-svg.php
Created January 25, 2016 21:29
WordPress get SVG file contents
<?php echo file_get_contents( get_stylesheet_directory_uri() . '/img/icons/your-logo-file.svg' ); ?>
The website encountered an error while retrieving https://cinchws.com/wp-admin/edit.php?s=&post_status=all&post_type=shop_order&_wpnonce=55c2dc4bff&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fpost_type%3Dshop_order&action=mark_completed&m=0&_email_id=&_customer_user=&shop_order_subtype=&paged=1&post%5B%5D=1902&post%5B%5D=1899&post%5B%5D=1897&post%5B%5D=1895&post%5B%5D=1893&post%5B%5D=1890&post%5B%5D=1882&action2=-1. It may be down for maintenance or configured incorrectly.
[04-Jan-2016 15:10:40 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'There was a problem connecting to the API.' in /home/cinchws/public_html/wp-content/plugins/woocommerce-xero/classes/requests/class-wc-xr-request.php:307
Stack trace:
#0 /home/cinchws/public_html/wp-content/plugins/woocommerce-xero/classes/class-wc-xr-contact-manager.php(56): WC_XR_Request->do_request()
#1 /home/cinchws/public_html/wp-content/plugins/woocommerce-xero/classes/class-wc-xr-contact-manager.php(84): WC_XR_Contact_Manager->get_id_by_email('toni@rvlife.com')
#2 /home/cinchws/public_html/wp-content/plugins/woocommerce-xero/classes/class-wc-xr-invoice-manager.php(132): WC_XR_Contact_Manager->get_contact_by_order(Object(WC_Order))
#3 /home/cinchws/public_html/wp-content/plugins/woocommerce-xero/classes/class-wc-xr-invoice-manager.php(37): WC_XR_Invoice_Manager->get_invoice_by_order(Object(WC_Order))
#4 [internal function]: WC_XR_Invoice_Manager->send_invoice(1906)
#5 /home/cinchws/public_html/wp-includes/plugin.ph
@spigotdesign
spigotdesign / ecp-widget.php
Last active September 11, 2019 13:40
Events Calendar Pro event
<?php $efeed = new WP_Query( array(
'post_type' => 'tribe_events',
'showposts' => 2,
'eventDisplay' => 'upcoming',
'start_date' => $current_date,
'end_date' => $current_date,
'orderby' => 'start_date',
'order' => 'ASC',
'tax_query' => array(
array(