Skip to content

Instantly share code, notes, and snippets.

View PurpleHippoDesign's full-sized avatar

Angie Vale PurpleHippoDesign

View GitHub Profile
@PurpleHippoDesign
PurpleHippoDesign / acf-gutenberg-blocks.php
Created June 10, 2019 09:18
Add colours to ACF colour picker
function themeprefix_acf_input_admin_footer() {
?>
<script type="text/javascript">
(function($) {
acf.add_filter('color_picker_args', function( args, $field ){
// add the hexadecimal codes here for the colors you want to appear as swatches
args.palettes = ['#F0F4F9', '#FFFBC5']
@PurpleHippoDesign
PurpleHippoDesign / remove-taxonomy-base.php
Created September 7, 2018 08:46
Remove taxonomy base from url
<?php
add_filter("request", "ph_change_term_request", 1, 1);
function ph_change_term_request($query)
{
$tax_name = "my_tax_name";
if (isset($query["attachment"]))
{
$include_children = true;
$name = $query["attachment"];
@PurpleHippoDesign
PurpleHippoDesign / create-sub-pages-for-custom-post-type.php
Created September 5, 2018 13:02
Creates 'fake' sub-pages for custom post types in WordPress. In this example we are creating 3 sub-pages called "About", "People" and "Information" for the CPT "department"
<?php
/*
* Creates fake sub pages for a custom post type.
*/
// Create 'Fake sub-pages' permalinks and titles.
$sub_pages = array(
'about' => 'About',
'people' => 'People',
'information' => 'Information',
@PurpleHippoDesign
PurpleHippoDesign / page-header.php
Created September 3, 2018 16:11
Moves titles for pages, posts, page for posts, archives, custom post type archives, category, tag and author archives into the header and wraps in markup
<?php
//* Add opening markup for the Page Header
add_action( 'genesis_before_header', 'wwd_opening_page_header' );
function wwd_opening_page_header() {
if (is_front_page() || is_search() || is_404() ) {
return;
}
@PurpleHippoDesign
PurpleHippoDesign / genesis-archive-title-removal.php
Created September 3, 2018 15:35
Removes Genesis archive titles
<?php //<~ Remove me
//Removes Title and Description on CPT Archive
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' );
//Removes Title and Description on Blog Archive
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
//Removes Title and Description on Date Archive
remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' );
//Removes Title and Description on Archive, Taxonomy, Category, Tag
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
@PurpleHippoDesign
PurpleHippoDesign / remove-archive-title-prefixes.php
Last active September 3, 2018 15:33
Remove archive title prefix from WordPress archive title
<?php //<~ Remove me
/**
* Remove archive title prefixes.
*
* @param string $title The archive title from get_the_archive_title();
* @return string The cleaned title.
*/
function ph_custom_archive_title( $title ) {
@PurpleHippoDesign
PurpleHippoDesign / retina-media-query.css
Last active August 29, 2015 14:27
Add retina logo to Genesis
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
.header-image .site-title > a {
float: left;
min-height: 133px;
@PurpleHippoDesign
PurpleHippoDesign / display-gallery-as-soliloquy-dynamic-slider.php
Last active October 3, 2015 02:18
Removing ACF front end dependency
@PurpleHippoDesign
PurpleHippoDesign / single-cpt.php
Last active January 27, 2017 11:09
Generate slideshow from ACF gallery field via Soliloquy Dynamic
<?php
add_action( 'genesis_entry_content', 'pbh_do_post_content', 9 );
function pbh_do_post_content() {
echo '<div class="slider-container">';
// If at least 1 image is present in the Project Images Gallery field
if( $images = get_field('gallery') ) {
@PurpleHippoDesign
PurpleHippoDesign / screen-reader-text-class.css
Last active January 10, 2016 15:11
CSS to hide anchor text for accessibility
a span.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}