This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Page Templater Demo | |
Plugin URI: http://www.damiencarbery.com/2017/09/grandchild-templates-made-easy/ | |
Description: Demonstrate how to use pagetemplater.php and the included filters | |
Version: 0.1 | |
Author: Damien Carbery | |
Author URI: http://www.damiencarbery.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_after_header', function () { | |
if ( is_front_page() ) | |
unregister_sidebar( 'welcome' ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'category_name' => 'portfolio', | |
'post_type' => 'post', | |
'paged' => get_query_var( 'paged' ), | |
); | |
$wp_query = new WP_Query( $args ); | |
if( $wp_query->have_posts() ): | |
while( $wp_query->have_posts() ): $wp_query->the_post(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use scrollreveal from https://github.com/jlmakes/scrollreveal | |
add_action( 'wp_footer', 'afp_scrollreveal_init' ); | |
function afp_scrollreveal_init() { | |
?> | |
<style> | |
.home .widget-wrap { visibility: visible; } | |
.site-inner .widget-wrap, .entry-content { visibility: hidden; } | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'sic_sticky_categories', 'pu_set_sticky_categories' ); | |
function pu_set_sticky_categories( $categories ) { | |
// Only operate on these two categories. | |
$categories[] = 'edge-case-2'; | |
$categories[] = 'media-2'; | |
return $categories; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
// Get 'body' background image and stretch it. | |
bg = $(document.body).css('background-image'); | |
// Change: url("/path/to/background") to: /path/to/background | |
bg = bg.replace('url(','').replace(')','').replace(/"/g, ''); | |
$(document.body).backstretch(bg); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Based on: http://markwilkinson.me/2014/09/altering-registered-post-type-args/ | |
// Hide some of the k-boom CPTs as they will not be used. | |
function ce_hide_some_cpts( $post_type, $args ) | |
{ | |
/* Only hide the post types listed in the array. */ | |
if (!in_array($post_type, array('audio', 'event', 'portfolio', 'video'))) { | |
return; | |
} | |
// Skip 'Events Manager' plugin (it has 'description' set while 'Events' CPT does not). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WooCommerce - No shipping method message | |
Plugin URI: http://www.damiencarbery.com/2017/10/change-no-shipping-methods-available-message/ | |
Description: Change the "no shipping method available" message to minimise customer confusion. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$images = get_field('photos'); | |
if ($images) { ?> | |
<div class="images"> | |
<?php | |
$alt = $images[0]['alt']; | |
if (empty($alt)) { | |
$alt = $images[0]['title']; | |
} | |
printf('<a href="%s" itemprop="image" class="main-image zoom thickbox" title="" rel="prettyPhoto[gallery] gallery"><img width="%d" height="%d" src="%s" class="attachment-shop_single size-shop_single wp-post-image" alt="%s" title="%s" /></a>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* An email to ask the vendor to check availability of a booking. | |
* | |
* @extends \WC_Email | |
* | |
* Code copied from: https://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/ | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |