Skip to content

Instantly share code, notes, and snippets.

@cdils
cdils / functions-step1.php
Last active October 25, 2022 17:09
Here's a tutorial for the following snippets showing you how to customize Yoast Breadcrumbs https://carriedils.com/modify-yoast-breadcrumb-text-for-parent-and-child-pages/
View functions-step1.php
<?php
/**
* Filter breadcrumbs on Salary Data pages.
*
* @param array $link The link array.
* @param array $breadcrumb The breadcrumb item array.
*
* @return str $link The link output.
*/
function zg_add_text_to_breadcrumb( $link, $breadcrumb ) {
@cdils
cdils / wpmdbpro-cli-remote-backup-script.sh
Last active October 25, 2022 19:21 — forked from JRGould/wpmdbpro-cli-remote-backup-script.sh
WP Migrate DB Pro CLI Backup Script
View wpmdbpro-cli-remote-backup-script.sh
#!/bin/bash
#
# Declare SITES as an associative array
declare -A SITES
# Format: SITES[WPMDB profile number]=backup_filename_base
SITES[1]=remote_backup_com
#SITES[2]=another_site_to_backup
#SITES[3]=my_other_blog
## These variables will be specific to the WordPress
@cdils
cdils / plugin-name.php
Created September 16, 2020 02:43
Alternative template path for Genesis Custom Blocks
View plugin-name.php
<?php
/**
* Gets an alternate template path for Genesis Custom Blocks.
*
* This is handy if you want to include GCB blocks in a plugin versus your theme.
* @param string $path The template path.
* @return string An alternate template path.
*/
function ccb_get_alternate_template_path( $path ) {
View functions.php
<?php //remove this line
add_filter( 'simple_social_default_profiles', 'biw_add_new_simple_icon' );
/**
* Add Houzz icon to Simple Social Icons plugin.
*
* @param array $icons Social icons to include in widget options.
*
* @return array Updated icon set.
*/
@cdils
cdils / gutenberg-style.css
Created May 9, 2018 13:48
This is an unminified version of the stylesheet that ships with the WordPress Gutenberg plugin. Original SCSS files are here -> https://github.com/WordPress/gutenberg/tree/master/core-blocks
View gutenberg-style.css
.wp-block-embed figcaption {
margin-top: .5em;
color: #6c7781;
text-align: center;
font-size: 13px
}
.editor-block-list__block[data-type="core/embed"][data-align=left] .editor-block-list__block-edit,
.editor-block-list__block[data-type="core/embed"][data-align=right] .editor-block-list__block-edit,
.wp-block-embed.alignleft,
@cdils
cdils / categories-template.php
Last active March 7, 2018 22:42
List Posts by Category in Genesis for WordPress - See tutorial for implementation: https://carriedils.com/create-page-list-posts-by-category-genesis-tutorial/
View categories-template.php
<?php
/**
* Template Name: Category Archives
*/
add_action( 'genesis_loop', 'custom_category_loop' );
/**
* Custom loop that display a list of categories with corresponding posts.
*/
function custom_category_loop() {
@cdils
cdils / archive-podcast.php
Last active April 26, 2017 10:57
Code used to register a 'podcast' CPT for officehours.fm. View CPT archive at https://officehours.fm/podcast/. Note that there's no loop customization. The archive page uses some hooks to move or remove certain elements and the "grid layout" is achieved via CSS (flexbox).
View archive-podcast.php
<?php
// Force full-width-content layout.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Move post info.
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_footer', 'genesis_post_info' );
// Remove post content
View functions.php
<?php
add_action( 'pre_get_posts', 'cd_show_all_posts' );
/**
* Show all posts on a specified archive page.
*
* @author Carrie Dils
* @link https://carriedils.com/genesis-archive-page/
* @param object $query data
*
View archive.php
<?php //remove this line
add_filter( 'genesis_term_intro_text_output', 'cd_do_archive_term_description' );
/**
* Show archive description only on first page of a taxonomy archive.
*
* @return string
*/
function cd_do_archive_term_description( $intro_text ) {
if ( is_paged() ) {
@cdils
cdils / bbpress.scss
Last active January 21, 2019 21:21
This is quick, sassified version of the default bbPress stylesheet. I did not sassify the media queries at this point (I intend to re-work those as mobile-first for my project). Also note that I kept the original stylesheet organization. There's repition of some selectors that could be avoidded if the current organization was disregarded. :) As …
View bbpress.scss
/**
* bbPress specific CSS
*
* @package bbPress
* @subpackage Theme
*/
/* =bbPress Style
-------------------------------------------------------------- */