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 / 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
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 / banner-warning-for-expireds.php
Created June 21, 2019 23:04 — forked from pbrocks/banner-warning-for-expireds.php
Add a banner message to the top of your site to let members know that their membership has expired.
<?php
/**
* Add a banner message to the top of your site to let members know that their membership has expired.
*/
// Let's build the banner message to display if member expired.
function extra_warning_for_renewal( $input ) {
global $pmpro_pages;
$target = get_permalink( $pmpro_pages['levels'] );
$message = 'Hi ' . $input['display_name'] . '. Your ' . ( ( $input['message'] ) ? $input['membership_name'] . ' subscription, expired on ' . $input['enddate'] . ' <a class="button-primary" href="' . esc_url( $target ) . '">' . $input['message'] . '</a>' : '' );
@itsjusteileen
itsjusteileen / my_pmpro_after_change_membership_level.php
Created June 21, 2019 21:01 — forked from strangerstudios/my_pmpro_after_change_membership_level.php
Only allow users to use the trial level once with Paid Memberships Pro.
<?php
/*
Only allow users to use the trial level once.
Add this code to your active theme's functions.php
or a custom plugin.
Be sure to change the $trial_level_id variable in multiple places.
*/
//record when users gain the trial level
function my_pmpro_after_change_membership_level($level_id, $user_id)
{
@itsjusteileen
itsjusteileen / change-level-only-when-user-expires.php
Last active June 21, 2019 18:34 — forked from andrewlimaza/change-level-only-when-user-expires.php
Change user's membership level only when a user expires from a specific level.
<?php
/**
* Change membership level for users expiring from startup level, moving them to primary level.
* Users can cancel their membership level after their before or after the membership level change.
*/
function wbon_change_default_level_when_expiring_startup( $user_id, $level_id ) {
global $wpdb;