Skip to content

Instantly share code, notes, and snippets.

View itsjusteileen's full-sized avatar
🎯
Focusing

Eileen Violini itsjusteileen

🎯
Focusing
View GitHub Profile
@itsjusteileen
itsjusteileen / functions.php
Created March 2, 2020 13:50
Removing Archive Title from Theme Archive Header
/**
* Remove archive title prefixes.
*
* @param string $title The archive title from get_the_archive_title();
* @return string The cleaned title.
*/
function custom_archive_title( $title ) {
// Remove any HTML, words, digits, and spaces before the title.
return preg_replace( '#^[\w\d\s]+:\s*#', '', strip_tags( $title ) );
}
@itsjusteileen
itsjusteileen / wclancpa-2019-imageblockstyle.js
Created January 19, 2020 16:13 — forked from pbrocks/wclancpa-2019-imageblockstyle.js
The core image block in WordPress does not ship with its own style, but you can easily add styles with the Block Style filter, thereby enabling you to target the block with custom CSS or JS. Here I am adding two, but only one will receive any treatment.
wp.blocks.registerBlockStyle( 'core/image', {
name: 'phader',
label: 'Philly Phader'
} );
@itsjusteileen
itsjusteileen / functions.php
Created January 15, 2020 21:05
Lists all SSP plugin podcast custom post type on the home page
<?php
/*
Plugin Name: SSP Customizations
Plugin URI: https://github.com/TheCraigHewitt/Seriously-Simple-Podcasting
Description: Customizations for the Seriously Simple Podcasting Plugin
Version: .1
Author: itsjusteileen
Author URI: https://github.com/itsjusteileen
*/
@itsjusteileen
itsjusteileen / functions.php
Last active October 19, 2019 14:22 — forked from braddalton/functions.php
Wordpress Reverse Order Posts in Category Archive
/**
* Add lines five to 10 to your child theme's functions.php file
*/
function change_category_order( $query ) {
if ( $query->is_category('8') && $query->is_main_query() ) {
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'change_category_order' );
@itsjusteileen
itsjusteileen / Reverse WordPress Archive Category Order
Created October 19, 2019 14:12 — forked from mahodder/Reverse WordPress Archive Category Order
Reverse WordPress post order on archive pages for specific categories only - add to functions.php
add_action( 'pre_get_posts', 'custom_reverse_post_order' );
function custom_reverse_post_order( $query ) {
if ( is_admin() )
return;
if ( $query->is_main_query() && is_archive() && ! is_post_type_archive() && ($query->query_vars['category_name'] == 'category-name' || $query->query_vars['category_name'] == 'category-name') ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'ASC' );
}
}
@itsjusteileen
itsjusteileen / pmpro-email-as-username.php
Last active September 6, 2019 14:45
Have members use their email address for logging in to your website powered with Paid Memberships Pro
<?php // Do not include in PMPro Customizations plugin
/**
* Have members use their email address for logging in to your website powered with Paid Memberships Pro
*
* Paste the code below into a PMPro Customization Plugin:
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
add_filter( 'gettext', 'wordpress_login_gettext', 20, 3 );
function wordpress_login_gettext( $translated_text, $text, $domain ) {
@itsjusteileen
itsjusteileen / pmpro-register-helper-example-fields.php
Created September 5, 2019 22:29 — forked from pbrocks/pmpro-register-helper-example-fields.php
These examples show the range of possibilities, including the 'niche' options, for fields used in Paid Memberships Pro's Register Helper Add-On.
<?php // Do not include this or the doc block if adding to a Customizations plugin
/**
* Add this to its own folder in your plugins directory or copy the code below this doc block to a Customizations Plugin and customize to suit your needs.
*
* Plugin Name: PMPro Register Helper Examples
* Description: Create a folder name in your plugins' folder with the same name as this filename, but without the .php extension. Save this file in that folder and then you can activate this plugin in your WordPress dashboard,
* Author: pbrocks
* Author URI: https://github.com/pbrocks
*/
@itsjusteileen
itsjusteileen / wps_load_scripts.php
Created September 2, 2019 17:57 — forked from wpsmith/wps_load_scripts.php
Enqueue Isotope
<?php
add_action( 'wp_enqueue_scripts', 'wps_load_scripts' );
/**
* Enqueue Isotope
* For commercially developed child themes, you must obtain a license
* from isotope.metafizzy.co for approx. $25.
*
* @author Travis Smith
* @link http://wpsmith.net
@itsjusteileen
itsjusteileen / functions.php
Created August 3, 2019 12:28 — forked from hlashbrooke/functions.php
Seriously Simple Podcasting: Remove 'Download file' link from episode meta data
add_filter( 'ssp_episode_meta_details', 'ssp_remove_download_link', 10, 3 );
function ssp_remove_download_link ( $meta, $episode_id, $context ) {
unset( $meta['link'] );
return $meta;
}
@itsjusteileen
itsjusteileen / ssp-podcast-category.php
Last active July 23, 2019 21:01
Add category support to Seriously Simple Podcasting Plugin
<?php
/*
Add categories support to the SSP plugin. Include this code in a blank customizations plugin for your site. If you already have a plugin, do not add the php opening tag in line one, only add code beginning at line 6.
*/
add_action( 'pre_get_posts', 'ssp_add_podcast_to_category_archives' );
function ssp_add_podcast_to_category_archives( $query ) {
if ( is_admin() ) {
return;