Skip to content

Instantly share code, notes, and snippets.

Understanding Child Themes in WordPress

A child theme is a theme that inherits the functionality and styling of another theme, known as the parent theme. Child themes allow you to modify or add to the functionality of the parent theme without directly editing its files. This ensures that your customizations are preserved when the parent theme is updated.

Benefits of Using a Child Theme

  • Safe Updates: Keep your customizations intact when updating the parent theme.
  • Organized Customizations: Maintain a clean separation between your code and the parent theme's code.
  • Selective Overrides: Override only the templates or functions you need to change.
<?php
/**
*
*/
public static function get_rule_logs( $query ) {
if (!isset($query['rule_id']) || !$query['rule_id']) {
return [];
}
@atwellpub
atwellpub / logs.php
Created April 14, 2022 21:41
Draft method of retrieving logs from database
<?php
/*
*
*/
public function get_special_logs( $query ) {
if (!isset($query['special_id']) || !$query['special_id']) {
return [];
}
@atwellpub
atwellpub / functions.php
Created October 4, 2021 16:52
Very simple child theme functions.php
<?php
class ChildTheme {
/**
*
*/
public function __construct() {
$this->load_hooks();
}
@atwellpub
atwellpub / class.register-taxonomy.php
Last active June 24, 2021 15:40
taxonomy registration for CPT
<?php
namespace Example\Register\Taxonomy;
class Profile_Tag {
static $taxonomy_name;
/**
* Initialize Profile_Tag class
@atwellpub
atwellpub / Google App Script - Replace Slide Content Using Google Sheet Data.js
Last active May 2, 2024 05:21
Google Apps Script function to replace text in Google Slides with Google Sheet values
/**
* Function to replace text in Google Slides with Google Sheet values
* @reference https://hudsonatwell.co/2020/10/03/how-to-use-google-slides-to-autogenerate-featured-images/
*/
function generate_featured_image() {
/* get spreadsheet from public view link */
var dataSpreadsheetUrl = "https://docs.google.com/spreadsheets/d/1necmbNPUsGJ3fwNiFpgNLbtH6c2RmJDwIQCPuhAfA7s/edit"; //make sure this includes the '/edit at the end
var ss = SpreadsheetApp.openByUrl(dataSpreadsheetUrl);
@atwellpub
atwellpub / inbound-cornerstone-builder.php
Last active July 29, 2019 23:59
An attempt to integrate Landing Pages by Inbound Now with the Cornerstone Page Builder. Landing Pages stores field variation data in separate meta keys, usually in the following format: `key-name` for variation A, `key-name-1' for variation B, `key-name-2` for C, etc. Notice how A does not have an appended suffix. The challenge for these page bu…
<?php
/*
Plugin Name: Inbound Extension - Cornerstone Builder
Plugin URI: http://www.inboundnow.com/
Description: Adds landing pages support to the cornerstone builder
Version: 1.0.8
Author: Inbound Now
Contributors: Hudson Atwell
Author URI: http://www.inboundnow.com/
*/
@atwellpub
atwellpub / functions.php
Last active December 11, 2018 01:12
Example of a Zapier Webhook listener that imports microblog entries into a CPT named 'news'
<?php
/**
* Zapier Webhook Listener - Creates a status update into the custom post type 'news' , tags it, categorizes it
*/
/* define your secret key - must match the webhook secret key you inputted into the Zapier Zap. */
$ztw_secretkey = 'supersecretkey';
/* hook action to the WordPress 'init' hook. This will process webhook requests from Zapier */
{
"2018-10-16 15:00:00": {
"id": 923330759510888400,
"id_str": "923330759510888448",
"name": "TweetBoostPRO",
"screen_name": "WPTweetBoost",
"location": "",
"description": "WordPress Plugin - Advanced tweet scheduler that helps WordPress admins schedule tweets from directly within the wp-admin. Check us out!",
"followers_count": 6,
"friends_count": 7,
<item>
<title>
Read our tutorial on how we use TweetBoostPro to create a novelty twitter bot! https://wptweetboost.com/tweet-campaigns/how-to-build-a-twitter-bot-using-wordpress-tweetboostpro/
#WordPress #DevChat #WPchat #devjournal #twitter
</title>
<pubDate>
Thu, 08 Nov 18 12:00:00 +0000
</pubDate>
<description>