Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Eileen Violini itsjusteileen

🎯
Focusing
View GitHub Profile
@itsjusteileen
itsjusteileen / functions.php
Created Mar 2, 2020
Removing Archive Title from Theme Archive Header
View functions.php
/**
* 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 Jan 19, 2020 — 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.
View wclancpa-2019-imageblockstyle.js
wp.blocks.registerBlockStyle( 'core/image', {
name: 'phader',
label: 'Philly Phader'
} );
@itsjusteileen
itsjusteileen / functions.php
Created Jan 15, 2020
Lists all SSP plugin podcast custom post type on the home page
View functions.php
<?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 Oct 19, 2019 — forked from braddalton/functions.php
Wordpress Reverse Order Posts in Category Archive
View functions.php
/**
* 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 Oct 19, 2019 — forked from mahodder/Reverse WordPress Archive Category Order
Reverse WordPress post order on archive pages for specific categories only - add to functions.php
View Reverse WordPress Archive Category Order
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 Sep 6, 2019
Have members use their email address for logging in to your website powered with Paid Memberships Pro
View pmpro-email-as-username.php
<?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 Sep 5, 2019 — 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.
View pmpro-register-helper-example-fields.php
<?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
*/
View wps_load_scripts.php
<?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 Aug 3, 2019 — forked from hlashbrooke/functions.php
Seriously Simple Podcasting: Remove 'Download file' link from episode meta data
View functions.php
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 Jul 23, 2019
Add category support to Seriously Simple Podcasting Plugin
View ssp-podcast-category.php
<?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;