Skip to content

Instantly share code, notes, and snippets.

View JoelEadeDesign's full-sized avatar

Joel Eade JoelEadeDesign

View GitHub Profile
@JoelEadeDesign
JoelEadeDesign / function.php
Created November 25, 2025 02:42
Bluesky Share Icon Shortcode for Elementor
// Function to create the BlueSky share button as an Elementor-style element
function generate_bluesky_elementor_button() {
if (is_singular(['post', 'page'])) {
$post_title = get_the_title(); // Get the current post title
$post_url = get_permalink(); // Get the current post URL
$encoded_title = urlencode($post_title); // URL encode the post title
$encoded_url = urlencode($post_url); // URL encode the post URL
$bluesky_url = "https://bsky.app/intent/compose?text={$encoded_title}%20{$encoded_url}"; // Create the full BlueSky URL
// Custom SVG code for BlueSky logo
@JoelEadeDesign
JoelEadeDesign / functions.php
Last active August 14, 2024 06:25
Elementor Device Preview Width iPhone 14 (393x852px)
/**
* Elementor Device Preview Sizes
*
* @return void
*/
function add_custom_elementor_editor_css() {
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
echo '<style>
/* iPhone 14 – smallest viewport the responsive preview can be */
@JoelEadeDesign
JoelEadeDesign / functions.php
Created April 23, 2024 01:58
Elementor Display Conditions for Page Templates
<?php
/**
* Elementor Conditions based on Page Template
*
* @return void
*/
add_action( 'elementor/theme/register_conditions', function( $conditions_manager ) {
class Page_Template_Condition extends ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {
@JoelEadeDesign
JoelEadeDesign / function-snippet.php
Last active May 13, 2024 03:27
WP Codebox 2 Device Preview
<?php
/**
* Responsive Preview WP Codebox
*
* @return void
*/
add_action("admin_head", "add_responsive_buttons_to_wpcodebox");
function add_responsive_buttons_to_wpcodebox()
{
@JoelEadeDesign
JoelEadeDesign / functions.php
Created June 3, 2022 00:57
Function to control WooCommerce Order Status by User Role
<?php
/* Source: https://quadlayers.com/change-order-status-automatically-in-woocommerce/ */
function user_role_order_status( $order_id ) {
if ( ! $order_id ) { return; }
$order = wc_get_order( $order_id );
// Change db prefix `wp_` of `wp_capabilities`, if required
$usermeta = get_user_meta( get_current_user_id(),'wp_capabilities', true );
// Enter the user role name to apply this function to
<?php
/*
* Allow Jet Smart Filters to show published posts
*/
add_action( 'elementor/query/jet-smart-filters', function( $query ) {
// Add `jet-smart-filters` to `Query ID` of `Post` widget
$query->set( 'post_status', [ 'publish' ] );
} );
?>
@JoelEadeDesign
JoelEadeDesign / elementor-custom-fonts.php
Created January 7, 2019 00:41
Add Custom Font Names to Elementor & GeneratePress Font Family drop-down
/* ------------------------------------
/* CUSTOM FONTS
/* ------------------------------------ */
/* ELEMENTOR */
function modify_controls( $controls_registry ) {
// First we get the fonts setting of the font control
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
// Then we append the custom font family in the list of the fonts we retrieved in the previous step
$new_fonts = array_merge( [ 'Biotif' => 'system' ], $fonts );
@JoelEadeDesign
JoelEadeDesign / elementor-custom-fonts.php
Created October 22, 2018 22:59
Add theme fonts to Elementor' Style Font Family Select Menus
<?php
/**
* Elementor Custom Fonts
* Source: https://merianos.wordpress.com/2017/09/22/elementor-register-custom-font-family-in-the-fonts-control/
*/
function modify_controls( $controls_registry ) {
// First we get the fonts setting of the font control
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
// Then we append the custom font family in the list of the fonts we retrieved in the previous step
@JoelEadeDesign
JoelEadeDesign / Remove COD for User Role Stockist
Last active August 29, 2015 14:22
WooCommerce Remove COD for User Role of Stockist
/* REMOVE COD FOR USER ROLE STOCKIST */
add_filter( 'woocommerce_available_payment_gateways', 'sow_checkout_restrictions', 10, 1 );
function sow_checkout_restrictions( $available_gateways ) {
global $woocommerce;
if (!empty(current_user_can('stockist') )) {
unset( $available_gateways['cod'] );