Skip to content

Instantly share code, notes, and snippets.

@phpmaps
phpmaps / list_terms_exclusions
Created February 6, 2015 06:32
list_terms_exclusions plugin
<?php
/*
Plugin Name: Pancake v. 1.1
Plugin URI: http://phpmaps.github.io/me/
Description: Hides wordpress categories that Johnny finds annoying when working in the admin!
Version: 1.1 rev 1 (Sea Gull)
Author: Doogs
Author URI: http://phpmaps.github.io/me/
*/
@lmartins
lmartins / functions.php
Last active November 3, 2023 19:28 — forked from woogist/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
@FrostyX
FrostyX / FacebookDebugger.php
Last active December 11, 2024 20:33
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.
@amdrew
amdrew / gist:1119f025ad896c05e2f5
Last active April 6, 2017 15:07
AffiliateWP - Custom logout redirect for Affiliates
<?php
/**
* AffiliateWP - Custom logout redirect for Affiliates
* By default, a user is sent to the wp-login.php?loggedout=true page
* Affiliates are logged out to the affiliate dashboard login screen
* Normal WP users are logged out and redirected to the site URL
*/
function affwp_custom_logout_redirect( $logout_url, $redirect ) {
@portfola
portfola / author.php
Last active May 6, 2023 18:15
Custom User Taxonomies in WordPress
<?php
/**
* The template for displaying Profile pages.
*
* Used for Artist and Cultural Org "mini" pages.
*
* @package ArtsWestchester
* @since ArtsWestchester 1.0
*/
@larrybotha
larrybotha / A.markdown
Last active March 3, 2021 10:41
Custom social sharing icons
<?php
/**
* Optimize WooCommerce Scripts
* Updated for WooCommerce 2.0+
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
@TimBHowe
TimBHowe / functions.php
Created March 7, 2014 22:15
Change the WordPress gallery html output
<?php
//Modify the output of the gallery short code
add_filter('post_gallery', 'scaffolding_post_gallery', 10, 2);
function scaffolding_post_gallery($attr) {
$post = get_post();
static $instance = 0;
$instance++;
if ( ! empty( $attr['ids'] ) ) {
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active June 16, 2025 08:57
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@TimBHowe
TimBHowe / functions.php
Last active May 24, 2022 16:21
Add "Company" field to WordPress user account and add sortable company column to the user backend.
//add&remove field from user profiles - sorce:http://davidwalsh.name/add-profile-fields
function modify_contact_methods($profile_fields) {
// Add new fields
$profile_fields['company'] = 'Company';
// Remove old fields
//unset($profile_fields['aim']);
return $profile_fields;