Skip to content

Instantly share code, notes, and snippets.

@Fastest17
Fastest17 / remove_zero_spaces.js
Last active November 2, 2022 21:06
jQuery - Remove zero spaces
function PreSaveAction() {
// remove all the zero width spaces ​ from the fields.
$(node).each(function (index, element) {
var exp = new RegExp(String.fromCharCode(8203), "g");
var editor = $(element);
var txt = editor.html()
txt = txt.replace(exp, '');
txt = txt.replace(/ /g, ' ')
txt = txt.replace(/ {2,}/g, ' ');
editor.html(txt);
@cabrerahector
cabrerahector / wordpress-sort-posts-by-views.md
Last active April 15, 2023 17:57
[WordPress Popular Posts] Adding Views column to the Posts Manage page

Adding Views column to the Posts Manage page

This Gist shows how to add a sortable Views column to the post/page/custom-post-type edit screen.

Out of the box, the script will display the Views column on both the Posts and Pages screens. You can change that by editing the $post_types_with_views_column array at the beginning of the script.

How do I add this to my site?

  1. Using the text editor of your preference, create a file called wpp-sortable-columns.php and add the contents of this script to it.
  2. Place the wpp-sortable-columns.php file in wp-content\plugins.
@aaronsummers
aaronsummers / Contact form 7 form builder shortcodes
Last active December 28, 2024 15:33
Contact form 7 all fields and country dropdown
[text text class:classname class:otherclassname placeholder "placeholder"]
[email* email placeholder "Email Address"]
[url* url placeholder "http://..."]
[tel* tel placeholder "Phone no."]
[range* number-slider min:0 max:100 placeholder "Ammount"]
[number* number-spinbox min:0 max:100 placeholder "Ammount"]
@jcarlosroldan
jcarlosroldan / bypass-hotlink.php
Created March 7, 2018 14:11
Simple and safe script to bypass hotlinking protection
@yanknudtskov
yanknudtskov / wp-admin-select2.php
Created March 7, 2017 22:51
Add select2 to all select fields in WordPress Admin
<?php
function enqueue_select2_jquery() {
wp_register_style( 'select2css', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all' );
wp_register_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array( 'jquery' ), '1.0', true );
wp_enqueue_style( 'select2css' );
wp_enqueue_script( 'select2' );
}
add_action( 'admin_enqueue_scripts', 'enqueue_select2_jquery' );
anonymous
anonymous / Background Big Text Crawl.markdown
Created July 6, 2016 12:27
Background Big Text Crawl

Background Big Text Crawl

Large text with a slight 3D perspective continually scrolls. The 'Infinite' effect is caused by the CSS animation looping at juuuuuust the right time to not be noticed. Best viewed fullscreen. Works nice as a backdrop.

A Pen by Octavector on CodePen.

License.

@ooobo
ooobo / assignEditUrls.gs
Last active June 24, 2020 12:59
put edit response urls for google form in linked spreadsheet
// install as a google script linked to the form, not the spreadsheet. must add a trigger to run assignEditUrls() on form submit.
// benefit of linking to the form is that copying the spreadsheet will copy the spreadsheet, form and script.
function assignEditUrls() {
var form = FormApp.getActiveForm();
var ss = SpreadsheetApp.openById(form.getDestinationId());
var sheet = ss.getSheets()[0];
var data = sheet.getDataRange().getValues();
var urlCol = 2; // column number where URL's should be populated; A = 1, B = 2 etc
var responses = form.getResponses();
@gokulkrishh
gokulkrishh / media-query.css
Last active October 28, 2025 18:36
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@pierandrea
pierandrea / Apps Script Code - Copy the edit response link from Google Forms entries into a Google Sheet
Last active September 9, 2024 06:46
Google Apps Script code to add Google Form edit response links to spreadsheet
@konradsroka
konradsroka / ks-custom-login.js
Created January 20, 2015 08:30
Add Placeholders To WordPress Login Form And Remove Labels
// ----------------------------------------------------
// Adding the placeholders in textfields of login form
// ----------------------------------------------------
jQuery(document).ready(function($) {
$('#loginform input[type="text"]').attr('placeholder', 'Username');
$('#loginform input[type="password"]').attr('placeholder', 'Password');