Skip to content

Instantly share code, notes, and snippets.

View dompascal's full-sized avatar

Dominic Pascal dompascal

View GitHub Profile
@dompascal
dompascal / wp-page-template.php
Created February 18, 2014 21:06
WP - Page template with conditional loop for the home page displaying posts assigned to the home-page category.
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the wordpress construct of pages
* and that other 'pages' on your wordpress site will use a
* different template.
*
* @package WordPress
@dompascal
dompascal / composer-install-global.txt
Created February 15, 2014 14:42
Install - Composer gloablly on OSX.
1. Install composer in Terminal with curl -s getcomposer.org/installer | php -d detect_unicode=Off
2. Move composer to the bin directory so it can be used globally with mv composer.phar /usr/local/bin/composer
@dompascal
dompascal / vim-shortcuts.txt
Created February 8, 2014 19:53
VIM - Shortcuts
i = insert at current location
a = insert after current location (append)
I = insert AT START of current line
A = insert AFTER END of current line
o = insert line below current line (open)
O = insert line ABOVE current line
s = delete character under cursor and start inserting in its place (substitute text)
S = delete all text on line and start inserting in its place (substitute line)
cw = delete to the end of current word and start inserting in its place (any movement command can be substituted for w)
cc = same as S (change line)
@dompascal
dompascal / css-animate-media-queries.css
Created February 6, 2014 20:09
CSS - Animate media queries
*{
-webkit-transition:all 1s ease;
-moz-transition:all 1s ease;
-o-transition:all 1s ease;
transition:all 1s ease;
}
/*
* Display Image from the_post_thumbnail or the first image of a post else display a default Image
* Chose the size from "thumbnail", "medium", "large", "full" or your own defined size using filters.
* USAGE: <?php echo my_image_display(); ?>
*/
function my_image_display($size = 'full') {
if (has_post_thumbnail()) {
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, $size);
@dompascal
dompascal / wp-site-url-config.php
Created December 15, 2013 17:31
WP - Changing the site urls via the wp-config.php
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
@dompascal
dompascal / cart.php
Created December 12, 2013 16:24
WOOCOMMERCE - Shopping Bag/Cart Template
<?php
/**
* Cart Page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@dompascal
dompascal / css-forms.css
Created December 12, 2013 15:54
WP - Forms CSS
/* forms */
/* ------------------------------------------------------------------------- */
form {
/*
width: 95%;
margin: 20px auto;
*/
}
input {
@dompascal
dompascal / woocomerce-shop-and-checkout-overide.css
Created December 12, 2013 15:43
Woocommerce - Shopping bag & Checkout CSS Override.
.woocommerce-page table.shop_table thead th {
background: black;
color:white;
text-transform: uppercase;
}
.woocommerce-cart form.shipping_calculator {
width: 50% !important;
}
.woocommerce-cart form.shipping_calculator input {
border: none;
@dompascal
dompascal / acf-repeater-loop.php
Created December 12, 2013 10:41
WP - ACF Repeater Loop
<?php if(get_field('slideshow_images')): ?>
<?php while(the_repeater_field('slideshow_images')): ?>
<?php $image = wp_get_attachment_image_src(get_sub_field('image_file'), 'full'); ?>
<img src="<?php echo $image[0]; ?>" alt="" />
<?php endwhile; ?>
<?php endif; ?>