Skip to content

Instantly share code, notes, and snippets.

View adamcapriola's full-sized avatar

Adam Capriola adamcapriola

View GitHub Profile
<?php
/**
* Add user meta to signify the user has just logged in
*
*/
add_action( 'wp_login', 'ac_fresh_login', 10, 2 );
function ac_fresh_login( $user_login, $user ) {
update_user_meta( $user->ID, 'fresh_login', 1 );
<?php
/*
Plugin Name: Discourse WordPress Integration
Description: This plugin contains all of the functions that deal with integrating WordPress and Discourse.
Author: Adam Capriola
Version: 1.0
Author URI: https://meta.discourse.org/users/adamcapriola/activity
*/
// Discourse info
@adamcapriola
adamcapriola / wordpress-discourse-sso.php
Created February 5, 2015 04:13
WordPress --> Discourse SSO
<?php
/**
* SSO "Page"
*
*/
add_action( 'parse_request', 'ac_parse_request' );
function ac_parse_request() {
// Check for SSO request
<?php
/**
* Sync Groups from WordPress to Discourse
*
* First creates 'groups' meta_key (which should be customized to your needs)
* Then it monitors for changes in the 'groups' meta_value and connects to Discourse API to sync groups
*
* WordPress References
* https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/meta.php?order=name#L235
* http://wordpress.stackexchange.com/questions/16835/how-to-hook-update-post-meta-and-delete-post-meta
<?php
/**
* Remove &nbsp;'s
* @link https://core.trac.wordpress.org/ticket/31157
* @link https://core.trac.wordpress.org/ticket/31676
*
*/
add_filter( 'the_content', 'ac_remove_nbsps', 10 ); // Adjust priorities if necessary
add_filter( 'widget_text', 'ac_remove_nbsps', 10 );
@adamcapriola
adamcapriola / lede-words.css
Created January 18, 2019 16:00
Styling for lede words
.lede-words {
font-weight: 700;
}
<?php
/**
* Carbon Fields: Post: Formatting
*
*/
add_action( 'carbon_fields_register_fields', 'ac_crb_register_fields_post_formatting' );
function ac_crb_register_fields_post_formatting() {
Container::make( 'post_meta', 'Formatting' )
@adamcapriola
adamcapriola / fancybox-image-links.php
Created January 18, 2019 16:58
Add Fancybox attribute to image links
@adamcapriola
adamcapriola / auto-tag-amazon-links-v2.php
Last active January 18, 2019 18:20
Auto-tag Amazon.com links (v2: Clean)
@adamcapriola
adamcapriola / safari-placeholder-line-height-fix.css
Last active January 18, 2019 19:28
Fix Line Height for Input Placeholders in Safari
.search-form input[type=search] {
line-height: revert;
}