Skip to content

Instantly share code, notes, and snippets.

@dherbold
dherbold / .gitignore
Created October 28, 2012 19:37 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@dherbold
dherbold / folio hackery
Created April 30, 2013 00:08
why don't (doesn't) this work?
<div class="indent">
<?php include_once('homepage-gallery.php')
$id = '222';
$existing_attachments = attachments_get_attachments($id);
if( is_array($existing_attachments) && !empty($existing_attachments) ) {
$attachment_index = 0;
echo '<ul>';
foreach ($existing_attachments as $attachment) {
$attachment_index++;
?>
@dherbold
dherbold / gist:5498123
Created May 1, 2013 20:30
kitchell.com: image slide show glitch'n. Images seem to load, but upon scrolling, go to white. there is a very slight background image you can see just as you click on slide thumbnail #2. It slides of the left hand side of the image area upwards and white covers the rest. I'm unsure of where this whole slide show is writing from... like which fi…
<div id="my-folio-of-works" class="prev_img svwp">
<ul>
<ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$args = array(
'post_parent' => 222,
'post_type' => 'attachment'
);
<?php
function my_force_ssl() {
return true;
}
add_filter('force_ssl', 'my_force_ssl', 10, 3);
==================================================================
// Remove WooCommerce Updater
<?php global $user;
if ( ! $user->uid) {
$dest = drupal_get_destination();
drupal_goto('user/login', array('query' => $dest));
}?>
<script>
jQuery(function(){
jQuery("a").each(function(){
if (jQuery(this).attr("href") == window.location.pathname){
jQuery(this).addClass("youarehere");
}
});
});
</script>
/ Redirect all traffic to non-www. For example yoursite.com
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) &&
($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') &&
// Check if Drupal or WordPress is running via command line
(php_sapi_name() != "cli")) {
if ($_SERVER['HTTP_HOST'] == 'www.youwebsite.com') {
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://yourwebsite.com'. $_SERVER['REQUEST_URI']);
exit();
}
@dherbold
dherbold / gist:8b74966297970da29d35602fd56a4732
Created August 8, 2017 00:16
WooCommerce Continue Shopping Button
<?php
/**
* Add Continue Shopping Button on Cart Page
* Add to theme functions.php file or Code Snippets plugin
*/
add_action( 'woocommerce_before_cart_table', 'woo_add_continue_shopping_button_to_cart' );
function woo_add_continue_shopping_button_to_cart() {
@dherbold
dherbold / wc-no-order-again.php
Created August 9, 2017 21:22 — forked from rynaldos-zz/wc-no-order-again.php
[WooCommerce] Remove the "order again" button
remove_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button' );
<?php /**
* @Title: WooCommerce Edit Checkout Billing Address fields
*/
add_filter( 'woocommerce_checkout_fields' , 'dfh_woo_mod_woo_billing_address_fields' );
function dfh_woo_mod_woo_billing_address_fields( $fields ) {
// Remove Billing Company Field
unset($fields['billing']['billing_company']);