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 | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'PR Services', | |
'menu_title' => 'PR Services', | |
'menu_slug' => 'pr-services', | |
'capability' => 'edit_posts', | |
'position' => 35, | |
'redirect' => false | |
)); |
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: Return translated WooCommerce page | |
Plugin URI: http://www.damiencarbery.com | |
Description: Required Polylang plugin. Returns ID of translated page. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
// A safe version of code suggested at: |
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: Years Since Shortcode (Hardcoded) | |
Plugin URI: http://www.damiencarbery.com | |
Description: Shortcode to display years since a date specified in the code. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
// '[years_since]' shortcode to display number of years since 1st Jan 2010. |
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( 'user_has_cap', 'cci_check_view_order_capability', 10, 3 ); | |
function cci_check_view_order_capability( $allcaps, $caps, $args ) { | |
if ( isset( $caps[0] ) ) { | |
switch ( $caps[0] ) { | |
case 'view_order' : | |
// Check that the current user billing_company and order billing company match. | |
$current_user = wp_get_current_user(); | |
$current_user_billing_company = get_user_meta( $current_user->ID, 'billing_company', true ); | |
$order = wc_get_order( $args[2] ); |
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: wp_filter functions | |
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/ | |
Description: List functions attached to all actions and filters. DON'T DO IT! | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
add_action( 'wp_head', 'wp_filter_the_wrong_way' ); |
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 transients. | |
if ( false === ( $transient_data = get_transient( 'transient_name' ) ) ) { | |
// Regenerate transient. | |
} | |
// Use post meta. | |
if ( false === ( $post_meta_data = get_post_meta(1, 'post_meta_name', true ) ) ) { | |
// Regenerate post meta. |
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 |
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: WordPress MultiSite Delete Sample Content | |
Plugin URI: http://www.damiencarbery.com/2017/07/multisite-delete-sample-content/ | |
Description: Delete the sample post, page and comment that is created for a new site in a WordPress MultiSite installation. Network Activate this plugin. | |
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 | |
/* | |
Plugin Name: MultiSite Upgrade - Set HTTP authentication | |
Plugin URI: http://www.damiencarbery.com/2017/08/multisite-allow-for-password-protected-site/ | |
Description: Set the basic authentication username and password during multisite upgrades. | |
Author: Damien Carbery | |
Version: 1.0 | |
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
<?php | |
// Do not load CSS that we don't need on this page. | |
add_action( 'wp_enqueue_scripts', 'sc_landing_remove_unused_styles', 100 ); | |
function sc_landing_remove_unused_styles() { | |
wp_dequeue_style( 'dashicons' ); | |
wp_dequeue_style( 'hctpc_desktop_style' ); | |
wp_dequeue_style( 'popup-maker-site' ); | |
wp_dequeue_style( 'wordpress-countdown-timer-plugin-styles' ); | |
} |