Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
WebEndevSnippets / functions.php
Created March 3, 2014 19:50
Gravity Forms: Auto login to site after GF User Registration Form Submittal
add_action( 'gform_user_registered','we_autologin_gfregistration', 10, 4 );
/**
* Auto login to site after GF User Registration Form Submittal
*
*/
function we_autologin_gfregistration( $user_id, $config, $entry, $password ) {
wp_set_auth_cookie( $user_id, false, '' );
}
<?php
/**
* Portfolio Archive
*
*/
/**
* Display as Columns
*
*/
@nickdavis
nickdavis / column-opening-div-class-examples.html
Created April 23, 2014 14:40
HTML Columns Opening Div Class examples for LeanThemes.co
<!-- For the first column you must include 'first' -->
<div class="pricing-column one-half first">
<div class="pricing-column one-third first">
<div class="pricing-column one-fourth first">
<!-- For later columns do not include 'first' -->
<div class="pricing-column one-half">
<div class="pricing-column one-third">
<div class="pricing-column one-fourth">
@wpmark
wpmark / editors-widget-menus.php
Created May 3, 2014 13:49
Allow WordPress Editors Access to Widgets and Menus
<?php
/***************************************************************
* Function pxlcore_give_edit_theme_options()
* Adds widgets and menus to editors.
***************************************************************/
function pxlcore_give_edit_theme_options( $caps ) {
/* check if the user has the edit_pages capability */
if( ! empty( $caps[ 'edit_pages' ] ) ) {
@Zodiac1978
Zodiac1978 / .htaccess
Last active May 3, 2024 12:11
Safer WordPress with these .htaccess additions
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
<IfModule mod_autoindex.c>
@fikrirasyid
fikrirasyid / removing-all-actions-from-hook
Created August 28, 2014 15:38
Removing All Actions From Hook
/**
* Unhook all action with some exception on wp_head and wp_footer
*/
function fr_unhook_wp_head_footer(){
global $wp_filter; // Where all the hooks and their actions are stored
// Actions that should not be removed from the wp_head hook
$wp_head_whitelist = array( 'wp_enqueue_scripts', 'wp_print_styles', 'wp_print_head_scripts' );
// Unhook actions from wp_head
@renventura
renventura / block-admin-login-memberpress-login-form.php
Last active February 28, 2017 22:24
Prevent Administrative Admin Login from the MemberPress Login Form
<?php //* mind this opening php tag
/**
* Snippet provided by MemberPress support and modified by Ren Ventura
**/
//* Kick admins out from MemberPress login form
add_filter( 'mepr-validate-login', 'kick_out_admins' );
function kick_out_admins( $errors ) {
@andrewroberts
andrewroberts / createPDF.gs
Last active December 29, 2023 07:49
Google Apps Script that merges the values from a Google Spreadsheet into a Google Doc template (does a mail merge) to create a GDoc or PDF. More details can be found at www.andrewroberts.net/2014/10/google-apps-script-create-pdf/. Go to https://tinyurl.com/yd8v2do2 if you would like me to set it up for you.
//
// Create a PDF by merging values from a Google spreadsheet into a Google Doc
// ==========================================================================
//
// Demo GSheet & script - http://bit.ly/createPDF
// Demo GDoc template - 1QnWfeGrZ-86zY_Z7gPwbLoEx-m9YreFb7fc9XPWkwDw
//
// Config
// ======
@jareware
jareware / s3-curl-backups.md
Last active May 11, 2024 23:39
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@jplhomer
jplhomer / disable-comments.sh
Created February 25, 2015 16:38
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...