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 / 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-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
*/
@pbrocks
pbrocks / customize-pmpro-login-redirect-url.php
Created June 28, 2018 16:36
Redirect your members based on their PMPro subscription level. If any users aren't members, the site's home url is returned.
<?php
/**
* customize_pmpro_login_redirect_url Creates conditions for each level to have its own confirmation URL
*
* @param [type] $return_url Different URL for each level
* @param [type] $request URL the user is coming from, ie login url.
* @param [type] $user user data
* @return [type] The URL of the level for user logging in
*/
function customize_pmpro_login_redirect_url( $return_url, $request, $user ) {
@pbrocks
pbrocks / pmpro-replacement-login-redirect.php
Created June 13, 2018 23:55
Replacement redirect for logins after TML update. This recipe will redirect PMPro admins to dashboard reports, single out subscribers to go to the Account page and everyone else to the Invoice page.
<?php
/**
* Redirect user based on user role after successful login.
*
* $pmpro_pages returns an array:
* * $pmpro_pages['account']
* * $pmpro_pages['billing']
* * $pmpro_pages['cancel']
* * $pmpro_pages['checkout']
* * $pmpro_pages['confirmation']
@pbrocks
pbrocks / pmpro-pmproap-text-changes.php
Last active July 5, 2018 19:48
Add this your customizations plugin to alter text for PMPro Add On Packages.
<?php
/**
* Add to PMPro Customizations plugin. Be sure not to include the opening php tag in line 1.
*
* Add this your customizations plugin to alter text for PMPro Add On Packages.
*/
add_action( 'pmpro_invoice_bullets_top', 'pmproap_pmpro_invoice_links_top' );
add_action( 'pmpro_invoice_bullets_top', 'pmproap_pmpro_member_links_top' );
function pmproap_pmpro_invoice_links_top() {
$invoice_title = 'Purchased Add Ons';
@pbrocks
pbrocks / redirect-for-confirmation.php
Created April 10, 2018 15:02
A function that will redirect users based on their PMPro membership level during confirmation.
<?php
/**
* The function some_kind_of_pmpro_redirection is an arbitrary name given to the
* function created to run this specific bit of code. You can name it anything
* meaningful that you like, assuming that it is unique to the code on the site.
*
* The name of the filter hook, however, is not arbitrary as this is something
* created by the PMPro plugin. In this case, pmpro_confirmation_url, tells
* WordPress when to run this code in the some_kind_of_pmpro_redirection function.
*
@andrewlimaza
andrewlimaza / next_payment_date_account.php
Last active November 30, 2021 19:19
Show next payment date under the 'Expiration' field in the PMPro Account Page
<?php
/**
* Show next payment date under 'Expiration' field in PMPro account page.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Works for PayPal Express and Stripe payment gateways.
* www.paidmembershipspro.com
*/
// Change the expiration text to show the next payment date instead of the expiration date
// This hook is setup in the wp_renewal_dates_setup function below
function my_pmpro_expiration_text($expiration_text) {
@carrieforde
carrieforde / brackets-extensions.md
Last active May 10, 2017 19:10
A list of Brackets Extensions I Love
@strangerstudios
strangerstudios / my_init_meta_copy.php
Created September 1, 2014 17:03
Syncing user meta fields between PMPro Shipping and Event Espresso.
/*
Copy PMPro shipping address fields to event espresso when they are blank for event espresso.
Add this code to a custom plugin or your active theme's functions.php,
then visit /?metacopy=1 as an administrator.
Make sure to understand the code before running so you know it is doing what you want it to.
*/
function my_init_meta_copy()
{
@rosswd
rosswd / multi-git-win.md
Last active February 28, 2024 09:46
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)