Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
spigotdesign / user-profile-picture.php
Last active September 26, 2022 04:38
Add WordPress image uploader to user profile.
/*
* Add custom user profile information
*
*/
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@cdils
cdils / change-style-load-order.php
Last active February 7, 2022 15:35
Change order of where Genesis child theme stylesheet is loaded on theme initialization.
<?php //Remove this line
/**
* Remove Genesis child theme style sheet
* @uses genesis_meta <genesis/lib/css/load-styles.php>
*/
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Enqueue Genesis child theme style sheet at higher priority
@cjkoepke
cjkoepke / functions.php
Created July 12, 2014 20:11
Modify User Profile Widget's Gravatar Size in Genesis Child Theme
<?php
/**
*
* Modify the size of the Gravatar in the User Profile Widget
*
* @author Calvin Koepke
* @since 1.0.0
*/
add_filter( 'genesis_gravatar_sizes', 'ck_user_profile' );
function ck_user_profile( $sizes ) {
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*
@bryanwillis
bryanwillis / debug-atts.php
Last active July 29, 2019 23:52
This allows you to debug all of the known genesis attributes available for filtering. Genesis attributes are used for adding classes, schema.org markup, id's, and any other html attributes to elements. Drop this in your functions.php
<?php
/**
* Debug Genesis Attributes
* @author Bryan Willis
*/
add_action( 'wp_footer', 'debug_genesis_attr_filters' );
function debug_genesis_attr_filters()
{
global $wp_filter; // current_filter() might be a better way to do this
$genesis_attr_filters = array ();
@Kelderic
Kelderic / custom_post_types.php
Last active August 8, 2023 13:39
This is set of helper classes to create and manage custom post types for WordPress. It gets added to a theme's logic folder, or libs or includes folders, and included in functions.php. Then the primary tracker class is initiated once, and used to create new CTPs.
<?php
/***********************************************************************/
/*************************** TRACKER CLASS ***************************/
/***********************************************************************/
if ( ! class_exists( 'Custom_Post_Types_Manager' ) ) {
class Custom_Post_Types_Manager {
@ohiosveryown
ohiosveryown / change-class-on-scroll.html
Last active May 9, 2024 16:56
Vanilla JS – change/add class based on scroll position.
// https://codepen.io/cmykw/pen/gemxJm
// layout
<nav/>
// style
<style>
body { min-height: 200vh; }
nav {
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo.
echo -----