Skip to content

Instantly share code, notes, and snippets.

View codepuncher's full-sized avatar
🙃
i do a code (or two)

Lee Hanbury codepuncher

🙃
i do a code (or two)
View GitHub Profile
@chrisjangl
chrisjangl / find_page_template.sql
Created May 17, 2019 15:03
WordPress: SQL query to find all pages that use a certain page template. Can use WP CLI to run this query without have to log into cPanel/phpMyAdmin. Need to replace <wp_prefix_> & <page-template.php> to match your setup.
SELECT * FROM `<wp_prefix_>postmeta` WHERE `meta_key` LIKE '_wp_page_template' AND `meta_value` LIKE '<page-tempate.php>'
@joshuafredrickson
joshuafredrickson / functions.php
Created February 12, 2019 16:05
WordPress: Generate @2x image sizes automatically.
<?php
/**
* @2x image sizes
*/
function make_it_retina($file, $width, $height, $crop = false) {
if ($width || $height) {
$resized_file = wp_get_image_editor($file);
if (!is_wp_error($resized_file)) {
$resized_file->resize($width * 2, $height * 2, $crop);
@blakethepatton
blakethepatton / Description.md
Last active November 7, 2023 09:37
Getting Mailhog running on a dev server (nginx, letsencrypt, ssl, ubuntu)

Get it running as a service

wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64

mv MailHog_linux_amd64 mailhog

chmod +x mailhog

sudo vi /etc/systemd/system/mailhog.service

@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active October 19, 2024 18:33
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@tatemz
tatemz / functions.php
Last active December 19, 2017 20:38
Fixing W3 Total Cache CDN with Beaver Builder CSS media
<?php
// W3 Total Cache Integration with Beaver Builder
add_filter( 'fl_builder_render_css', __NAMESPACE__ . '\bb_plugin_cdn_url' );
function bb_plugin_cdn_url( $css ) {
// Based on wp-content/plugins/w3-total-cache/extensions/WordPressSEO.php
if ( class_exists( 'W3_Plugin_CdnCommon' ) ) {
$site_url = wp_upload_dir();
@alexkalh
alexkalh / php-convert-color-code-from-hex-to-rgba
Created January 7, 2015 03:23
php-convert-color-code-from-hex-to-rgba
<?php
function ak_convert_hex2rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
if (empty($color))
return $default;
if ($color[0] == '#')
$color = substr($color, 1);