Skip to content

Instantly share code, notes, and snippets.

Avatar

Damien Carbery damiencarbery

View GitHub Profile
View post-order-by-category.php
<?php
/*
Plugin Name: Change post order by category
Plugin URI: https://www.damiencarbery.com
Description: Order Blog category by date, rest alphabetically.
Author: Damien Carbery
Version: 0.1
*/
View i18-demo-internationalized.php
<?php
// Load the translations, if there are any.
add_action( 'init', 'dcwd_i18n_demo_load_theme_textdomain' );
function dcwd_i18n_demo_load_theme_textdomain() {
load_plugin_textdomain( 'i18n-demo', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'wp_head', 'dcwd_internationalized_code' );
function dcwd_internationalized_code() {
@damiencarbery
damiencarbery / media-list.php
Last active Jul 17, 2020
List all media uploaded to a WordPress site
View media-list.php
<?php $time_start = microtime(true); ?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title>List uploaded media</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<h1>List uploaded media</h1>
@damiencarbery
damiencarbery / google-maps-json-colouring.html
Created Jul 17, 2020
Change Google Maps colours - Liven up your embedded Google Maps with some colour changes. - https://www.damiencarbery.com/2020/07/change-google-maps-colours/
View google-maps-json-colouring.html
<div id="map"></div>
<script>
var address = "A94 A2T7, Ireland";
var infoWindowContent = '<strong>Reform Dublin Blackrock</strong><br />Bath Place (behind Blackrock Main Street)<br />Blackrock<br />Co. Dublin</p>';
var zoomLevel = 16;
function initialize() {
var myOptions = {
zoom: zoomLevel,
@damiencarbery
damiencarbery / customer-name-to-new-order-email.xml
Last active Jul 13, 2020
Add customer address to OpenCart order alert email - Include the customer name and address for a more complete order email. https://www.damiencarbery.com/2020/07/add-customer-address-to-opencart-order-alert-email/
View customer-name-to-new-order-email.xml
<?xml version="1.0" encoding="UTF-8"?>
<modification
xmlns="https://github.com/vqmod/vqmod"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/vqmod/vqmod https://raw.githubusercontent.com/vqmod/vqmod/master/vqmod.xsd">
>
<id>Add customer name and address to email alert</id>
<version>1.0</version>
<vqmver>2.X</vqmver>
<author>Damien Carbery</author>
@damiencarbery
damiencarbery / append-private-page-to-content.php
Last active Jul 5, 2020
Append private page to content - Append a specified page to post or page content. https://www.damiencarbery.com/2020/07/append-private-page-to-content/
View append-private-page-to-content.php
<?php
/*
Plugin Name: Append content to all pages and posts
Plugin URI: https://www.damiencarbery.com/2020/07/append-content-to-all-pages-and-posts/
Description: Append a specified (private) page to all pages and posts.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / cf7-redirect-after-submission.php
Last active Jul 1, 2020
Contact Form 7 - Redirect after submission - Redirect user to new page after successful submission of a Contact Form 7 form. http://www.damiencarbery.com/2020/06/contact-form-7-redirect-after-submission/
View cf7-redirect-after-submission.php
<?php
/*
Plugin Name: Contact Form 7 - Redirect after submission
Plugin URI: http://www.damiencarbery.com/2020/06/contact-form-7-redirect-after-submission/
Description: Redirect user to new page after successful submission of a Contact Form 7 form.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / acf-date-picker-start-end-date-twinned.php
Created Jun 20, 2020
ACF Date Picker - set end date to after start date - With two related date picker fields limit the end date to be after the start date. http://www.damiencarbery.com/2020/06/acf-date-picker-set-end-date-to-after-start-date/
View acf-date-picker-start-end-date-twinned.php
<?php
/*
Plugin Name: ACF Date Picker - set end date to after start date
Plugin URI: http://www.damiencarbery.com/2020/06/acf-date-picker-set-end-date-to-after-start-date/
Description: With two related date picker fields limit the end date to be after the start date.
Author: Damien Carbery
Version: 0.1
*/
View scheduled-task-wp.php
<?php
/*
Plugin Name: Weekly email
Plugin URI: http://www.damiencarbery.com
Description: Project status weekly automated email.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / add-manage-options-to-user.php
Created Jun 15, 2020
Add capability to a specific user - Add 'manage_options' capability to an non-admin user. https://www.damiencarbery.com/2020/06/add-capability-to-a-specific-user/
View add-manage-options-to-user.php
<?php
/*
Plugin Name: Add capability to a specific user
Plugin URI: https://www.damiencarbery.com/2020/06/add-capability-to-a-specific-user/
Description: Add 'manage_options' capability to an non-admin user.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
You can’t perform that action at this time.