Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Plugin Name: NCI.ie
Plugin URI: http://www.damiencarbery.com
Description: Customisations of Genesis Sample theme for NCI.ie.
Author: Damien Carbery
Version: 0.1
$Id: n-c-i.php 4192 2017-01-30 11:18:28Z damien $
*/
@damiencarbery
damiencarbery / mu-debug-info.php
Created April 25, 2017 13:43
Add debug information as a html comment for the specified IP address.
<?php
/*
Plugin Name: Debug Information
Plugin URI: http://www.damiencarbery.com
Description: Add debug information as a html comment for the specified IP address.
Author: Damien Carbery
Version: $Revision: 4185 $
$Id: mu-debug-info.php 4185 2017-01-23 17:09:47Z damien $
*/
@damiencarbery
damiencarbery / archive-pati_videos.php
Created April 28, 2017 11:43
PATI Videos CPT - Archive problems
<?php get_header(); ?>
<?php // $Id: archive-pati_videos.php 4154 2016-12-05 10:54:02Z damien $ ?>
<div id="main-content">
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<?php if (is_user_logged_in()) { ?>
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
@damiencarbery
damiencarbery / disable-simple-social-icons-css.php
Created May 9, 2017 16:48
Disable the CSS added to <head> by Simple Social Icons plugin.
<?php
add_action( 'wp_head', 'afp_wp_head_checks', 1 );
function afp_wp_head_checks() {
global $wp_filter;
$action = 'wp_head';
$priority = 10;
$function = 'css';
foreach ( $wp_filter[ $action ]->callbacks[ $priority ] as $callback_id => $callback_info ) {
if ( is_array( $callback_info ) ) {
@damiencarbery
damiencarbery / acf-create-options-page.php
Last active May 14, 2017 22:04
Use Advanced Custom Fields PRO Repeater field to use data in multiple places.
<?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
));
@damiencarbery
damiencarbery / years-since-hardcoded.php
Last active June 5, 2017 22:54
Display years/days/weeks since a certain date.
<?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.
@damiencarbery
damiencarbery / post-meta-transients-almost-identical.php
Last active June 26, 2017 10:52
Using Post Meta instead of Transients
<?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.
@damiencarbery
damiencarbery / wpms-delete-sample-content.php
Last active July 17, 2017 07:55
WordPress Multisite: Delete sample content after a new site is created.
<?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
*/
@damiencarbery
damiencarbery / ms-upgrade-http-authentication.php
Created August 20, 2017 15:45
WordPress Multisite - Allow for password protected site
<?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/
*/
@damiencarbery
damiencarbery / utility-shortcodes.php
Last active September 4, 2017 12:03
Handy shortcodes for use on any WordPress site
<?php
/*
Plugin Name: Utility Shortcodes
Plugin URI: http://www.damiencarbery.com/2017/09/utility-shortcodes/
Description: Various simple but useful shortcodes.
Author: Damien Carbery
Version: 0.2
*/
function us_simple_shortcodes($atts, $content, $code) {