Skip to content

Instantly share code, notes, and snippets.

Avatar

Damien Carbery damiencarbery

View GitHub Profile
@damiencarbery
damiencarbery / accordion-block-export.xml
Created Sep 28, 2020
Distribute Genesis Custom Block in a plugin - Include the Genesis Custom Block definition as part of the plugin to simplify distribution. https://www.damiencarbery.com/2020/09/distribute-genesis-custom-block-in-a-plugin/
View accordion-block-export.xml
<item>
<title>Accordion block</title>
<link>https://example.com/genesis_custom_block/accordion-block/</link>
<pubDate>Tue, 15 Sep 2020 12:16:12 +0000</pubDate>
<dc:creator><![CDATA[me]></dc:creator>
<guid isPermaLink="false">https://example.com/?post_type=genesis_custom_block&#038;p=8</guid>
<description></description>
<content:encoded><![CDATA[{"genesis-custom-blocks\/accordion-block":{"name":"accordion-block","title":"Accordion block","excluded":[],"icon":"list","category":{"slug":"widgets","title":"Widgets","icon":null},"keywords":[""],"fields":{"title":{"name":"title","label":"Title","control":"text","type":"string","order":0,"location":"editor","width":"100","help":"","default":"","placeholder":"","maxlength":null},"content":{"name":"content","label":"Content","control":"textarea","type":"textarea","order":1,"location":"editor","width":"100","help":"","default":"","placeholder":"","maxlength":null,"number_rows":4,"new_lines":"autop"}}}}]]></content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:
@damiencarbery
damiencarbery / css-slider.php
Last active Sep 21, 2020
Pure CSS slider - proof of concept - A slider using only CSS transitions. https://www.damiencarbery.com/2020/09/pure-css-slider-proof-of-concept/
View css-slider.php
<!DOCTYPE html>
<html>
<head>
<title>CSS fade in/out slider</title>
</head>
<?php
$slides = array( '<div><img src="http://placekitten.com/g/612/612"/></div>',
'<div><img src="https://unsplash.it/id/237/612/612"/></div>',
'<div><img src="https://unsplash.it/id/400/612/612"/></div>',
'<div><img src="https://unsplash.it/id/181/612/612"/></div>',
@damiencarbery
damiencarbery / truncated-archives-widget.php
Last active Sep 9, 2020
Truncated Archives Widget - A variation on the core Archives widget where it is like a yearly list in addition to the months of the current year. https://www.damiencarbery.com/2020/09/truncated-archives-widget/
View truncated-archives-widget.php
<?php
/*
Plugin Name: Truncated Archives Widget
Plugin URI: https://www.damiencarbery.com/2020/09/truncated-archives-widget/
Description: A variation on the core Archives widget where it is like a yearly list in addition to the months of the current year.
Author: Damien Carbery
Version: 0.1
*/
class Truncated_Archives_Widget extends WP_Widget {
@damiencarbery
damiencarbery / cta-over-hero-on-inner-pages.php
Last active Aug 17, 2020
CTA over hero image on inner pages in Essence Pro - Add a CTA on the Essence Pro hero image on inner pages (i.e. not on home page) https://www.damiencarbery.com/2020/08/cta-over-hero-image-on-inner-pages-in-essence-pro/
View cta-over-hero-on-inner-pages.php
<?php
/*
Plugin Name: CTA over hero image on inner pages in Essence Pro
Plugin URI: https://www.damiencarbery.com/2020/08/cta-over-hero-image-on-inner-pages-in-essence-pro/
Description: Add a CTA on the Essence Pro hero image on inner pages (i.e. not on home page).
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / recovery-mode-email.php
Last active Aug 23, 2020
Set recovery mode email address - Change the recovery mode email address to which the fatal error emails are sent to, instead of bothering and potentially confusing the site admin. https://www.damiencarbery.com/2020/08/set-recovery-mode-email-address/
View recovery-mode-email.php
<?php
/*
Plugin Name: Change Recovery Mode Email
Plugin URI: https://www.damiencarbery.com/2020/08/set-recovery-mode-email-address/
Description: Set the recovery mode email address to which the fatal error emails are sent to, instead of bothering and potentially confusing the site admin. From: https://developer.wordpress.org/reference/hooks/recovery_mode_email/#comment-3265
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version 0.1
*/
@damiencarbery
damiencarbery / post-order-by-category.php
Last active Aug 31, 2020
Change post order by category - Order a specific category by date, rest alphabetically. https://www.damiencarbery.com/2020/08/change-post-order-by-category/
View post-order-by-category.php
<?php
/*
Plugin Name: Change post order by category
Plugin URI: https://www.damiencarbery.com/2020/08/change-post-order-by-category/
Description: Order a specific category by date, the rest alphabetically.
Author: Damien Carbery
Version: 0.1
*/
View cta-over-hero-on-inner-pages.php
<?php
/*
Plugin Name: CTA over hero image on inner pages
Plugin URI: https://www.damiencarbery.com
Description: Add a CTA on the hero image on inner pages (i.e. not on home page).
Author: Damien Carbery
Version: 0.1
*/
//<a class="button primary" href="#newsletter">Join Us Today</a>
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>
You can’t perform that action at this time.