Skip to content

Instantly share code, notes, and snippets.

View dompascal's full-sized avatar

Dominic Pascal dompascal

View GitHub Profile
@dompascal
dompascal / wp-conditional-page-content.php
Created November 23, 2013 11:04
WP - Conditonal Page Content
<?php if (is_page('home')) { ?>
<?php } elseif (is_page('enter-page-here')) { ?>
<?php } else { ?>
<?php } ?>
@dompascal
dompascal / wp-include-page-template.php
Created November 23, 2013 11:05
WP - Include page template
<?php include('template-name-here.php'); ?>
@dompascal
dompascal / wp-query-specific-page-or-post.php
Created November 23, 2013 11:06
WP - Query of specific page/post
<?php $my_query = new WP_Query('category_name=sctv&showposts=1'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php endwhile; ?>
@dompascal
dompascal / wp-header-template.php
Created November 23, 2013 11:07
WP - Header Template
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Boilerplate
* @since Boilerplate 1.0
*/
@dompascal
dompascal / wp-footer-template.php
Created November 23, 2013 11:07
WP - Footer Template
@dompascal
dompascal / wp-image-sizes-function
Created November 23, 2013 11:08
WP - Image Sizes Function
if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 600, 50, true ); // Normal post thumbnails
add_image_size( 'thumb',150, 9999 ); // Permalink thumbnail
}
@dompascal
dompascal / social-media-links.html
Created November 23, 2013 11:09
HTML - Social Media Links
@dompascal
dompascal / wp-acf-flexible-content-leaderboard-ad.php
Created November 23, 2013 11:11
WP - ACF - Flexible Content - Leaderboard AD
<?php while(has_sub_field('ads','option')): ?>
<?php if(get_row_layout() == '728_x_90_leaderboard'): ?>
<!-- leaderboard AD -->
<span class="leaderboard">
<?php if(get_sub_field('ad_image_728_x_90')) { ?>
<a class="ad" href="<?php the_sub_field('ad_link_728_x_90'); ?>" target="_blank">
<?php $image = wp_get_attachment_image_src(get_sub_field('ad_image_728_x_90'), 'large'); ?>
<img src="<?php echo $image[0]; ?>" alt="" />
</a>
@dompascal
dompascal / wp-mobile-conditionals.php
Created November 23, 2013 12:18
WP - Mobile conditional statements (Uses the mobble wp plugin)
<?php if (is_mobile() ) : ?>
<?php else : ?>
<?php endif; ?>
@dompascal
dompascal / ssh-tar-to-another-server
Created November 27, 2013 21:24
SSH - TAR to another server
tar zcvf - /folder-to-back-up/ | ssh [email protected] "cat > /folder-to-back-up-to/backup.tar.gz"