Skip to content

Instantly share code, notes, and snippets.

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 / 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;
@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 / 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 / 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 / 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 / UserForm
Created February 18, 2016 22:35
Software Licensing for Excel Add-In UserForm Deactivate
Private Sub LicenseKeyDeactivate_Click()
If license.Value = "" Then
MsgBox "Please enter a license key.", vbExclamation, "Input Data"
Exit Sub
Else
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet1").Range("A1")
.Cells(1, 1).Value = license.Value
@ScottDeLuzio
ScottDeLuzio / UserForm
Created February 18, 2016 22:33
Software Licensing for Excel Add-In UserForm Activate
Private Sub LicenseKeyActivate_Click()
'license.Value is what the user entered into the text box on the UserForm.
If license.Value = "" Then
MsgBox "Please enter a license key.", vbExclamation, "Input Data"
Exit Sub
Else
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet1").Range("A1")
.Cells(1, 1).Value = license.Value
@ScottDeLuzio
ScottDeLuzio / ThisWorkbook
Created February 18, 2016 21:12
Software Licensing for Excel Add-In Check License on Startup
Private Sub Workbook_Open()
httpRequestCheck
With ThisWorkbook.Worksheets("Sheet1").Range("A1")
' the And .Cells(4, 1) = 0 is probably redundant, and if you are allowing more than one activation per license key you should remove that part.
If .Cells(3, 1).Value = "valid" And .Cells(4, 1) = 0 And .Cells(5, 1) <> "in_use" Then
'call your add-in here
Else
'if the license is not valid, the number of activations remaining is greater than 0, and it is not in use elsewhere we should display the license activation UserForm.
Activate_License
End If
@ScottDeLuzio
ScottDeLuzio / Module1
Created February 18, 2016 21:04
Software Licensing for Excel Add-In Workbook Activation/Open
Sub Activate_License()
'Show the license key activation UserForm (mine is creatively named LicenseKey)
LicenseKey.Show
End Sub