Skip to content

Instantly share code, notes, and snippets.

@danielpost
danielpost / actions.php
Last active March 11, 2017 10:32
Preload blurred image and fade in full image
<?php
/**
* Adds a Base64 encoded version of the Featured Image thumbnail
* to post meta
*
* @param int $post_id ID of the post that's being updated.
*/
function dp_add_base64_featured_image_thumb($post_id) {
// If this is just a revision, don't do anything.
if (wp_is_post_revision($post_id)) {
@AustinGil
AustinGil / hero-section.php
Last active April 22, 2019 09:27
An example of my "Progressive Lazy Load" technique in WordPress using vanilla Javascript
<?php while (have_posts()) : the_post(); ?>
<?php
// Get the placeholder image and full size image URLs
if ( has_post_thumbnail() ) {
$image_id = get_post_thumbnail_id();
$full_size_image = wp_get_attachment_image_src( $image_id,'full', true);
$full_size_image_url = $full_size_image[0];
$placeholder_image = wp_get_attachment_image_src( $image_id,'thumbnail', true);
<?php
/*
Extends Visual Composer
More information can be found here: http://kb.wpbakery.com/index.php?title=Category:Visual_Composer
*/
// don't load directly
@lukaszgrolik
lukaszgrolik / font-weights.md
Last active April 24, 2024 11:29
Commonly used names for CSS font-weight values

unknown source

value name
100 extralight/ultralight
200 light/thin
300 book/demi/light
400 regular/normal
500 medium
600 semibold/demibold
@bitfade
bitfade / gist:4555047
Last active January 21, 2022 03:06
WordPress - Remove empty p tags for custom shortcodes
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/