Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
ScottDeLuzio / text_widget
Created March 3, 2016 21:39
Text Widget Setup for Hover Text on Image
<!-- Replace http://yoursite.com/link-to-a-page with the actual link to the page you want to link to -->
<a href="http://yoursite.com/link-to-a-page">
<!-- Replace http://yoursite.com/wp-content/uploads/2016/02/your-image.jpg with the actual image URL -->
<img src="http://yoursite.com/wp-content/uploads/2016/02/your-image.jpg" alt="" />
<div class="hover-text">The text you want to display</div>
</a>
@ScottDeLuzio
ScottDeLuzio / widget
Created March 3, 2016 22:08
Get widget class
// We want to know the widget-4 part below. Yours will likely be a different number depending on where your widget is in the widget area.
<div class="widget-4 widget-even widget-wrap">
@ScottDeLuzio
ScottDeLuzio / style.css
Created March 3, 2016 22:21
Hover Text on Widget Image
/* Replace the width and height values with your image's width and height */
/* You may need to play with the margin-top and margin-left values to get the hover effect lined up exactly over your image */
.hover-text {
width: 250px;
height: 184px;
display: none;
margin-top: -193px;
margin-left: 13px;
}
/* This uses a black background with 75% opacity, and white text that is aligned in the center. Adjust as necessary. */
@ScottDeLuzio
ScottDeLuzio / style.css
Created March 3, 2016 22:49
Widget Hover Text on Mobile
/* Resize hover text area for screen sizes smaller than 480px wide. Repeat for other screen sizes as needed */
@media only screen and (max-width: 480px) {
.hover-text {
width: 261px;
height: 192px;
display: none;
margin-top: -201px;
margin-left: 13px;
}
.widget-4:focus .hover-text {
@ScottDeLuzio
ScottDeLuzio / strip-shortcode.php
Created March 15, 2016 20:58
Strip shortcodes from the content home/blog page
<?php
/*
Plugin Name: Strip Shortcodes
Description: Strip shortcodes from home/blog posts page
*/
function strip_shortcode_from_excerpt( $content ) {
if ( is_home() ) {
$content = strip_shortcodes( $content );
}
return $content;
jQuery(document).ready(function()
{
jQuery("#order_comments").attr('maxlength','140'); // make sure to change the 140 number here to match the number after remaining below
countdownCharacters();
jQuery('#order_comments').change(updateCountdown);
jQuery('#order_comments').keyup(updateCountdown);
});
function countdownCharacters() {
// 140 is the max message length
var remaining = 140 - jQuery('#order_comments').val().length;
@ScottDeLuzio
ScottDeLuzio / wordpress-plugin-svn-to-git.md
Last active September 3, 2016 22:40 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
// Replace this
function wp_jv_prg_add_rg_meta_box_head() {
add_meta_box('wp_jv_prg_sectionid','WP JV Reading Groups','wp_jv_prg_add_rg_meta_box', 'post','side','high');
add_meta_box('wp_jv_prg_sectionid','WP JV Reading Groups','wp_jv_prg_add_rg_meta_box', 'page','side','high');
}
// With this
function wp_jv_prg_add_rg_meta_box_head() {
$post_types = wp_jv_prg_get_post_types();
@ScottDeLuzio
ScottDeLuzio / stripe.php
Last active January 25, 2024 18:13
Add card to customer account in Stripe
<?php
// Function to add a new card for your customer.
function sd_process_add_customer_card(){
$redirect = false;
if ( isset( $_POST['action'] ) && $_POST['action'] == 'add_customer_card' && wp_verify_nonce( $_POST['stripe_nonce'], 'stripe-nonce' ) ){
if ( !isset( $_POST['card_number'] ) || !isset( $_POST['card_cvc'] ) || !isset( $_POST['card_exp_month'] ) || !isset( $_POST['card_exp_year'] ) ){
$redirect = add_query_arg( array(
'card' => 'not-created',
), $_POST['redirect'] );
@ScottDeLuzio
ScottDeLuzio / mainwp.php
Created January 25, 2017 22:55
mainwp_addsite and mainwp_editsite
// for add child site
$params = array(
'url' => 'http://childsite.com', // child site url
'name' => 'my child site', // set name
'wpadmin' => 'admin-user-name',
'unique_id' => '', // set value if needed
'groupids' => array( ... ), // array of group ids
'ssl_verify' => 0, // or 1, 2
'ssl_version' => 'auto',
'http_user' => '', // set value if needed