Skip to content

Instantly share code, notes, and snippets.

View indikatordesign's full-sized avatar

Bruno Bouyajdad indikatordesign

View GitHub Profile
@indikatordesign
indikatordesign / coming-soon-snippet.php
Last active September 9, 2017 09:59
[Divi Coming Soon Snippet]Divi allows you to create coming soon pages (blank template), but when someone tries to reach something like "my-domain.com/about/", it will achieve it because there is no implementation to hide those pages.This is what this simple snippet can do for you.
<?php
// Create a page called "Coming Soon"
// Make sure that the permalink looks like this: my-domain.com/coming-soon/
// Then paste the snippet below into your themes (child-themes) functions.php.
// After inserting, any user who is not logged-in will be redirected to your coming-soon page.
add_action( 'init', function()
{
if( ! is_user_logged_in() )
@indikatordesign
indikatordesign / footer.php
Last active November 5, 2021 01:29
[Divi Footer Template]This footer.template let you setup easily your company name, wrapped into your website-url. It also takes care for automatic update of the year in your socket.You just need to change the values in the variables "$myCompany and $myURL" at the top of this code panel. Then simply put this file in the root of your child-theme.
@indikatordesign
indikatordesign / wp-config.php
Last active October 27, 2017 13:49
[WordPress Debug.log and useful var_dump snippet]Allows you to write the error.log right into the wp-content-folder. You can also use something like this to var_dump to your error log: - idWriteLog( $myVar, 'varName' ); - or - idWriteLog( myFunc(), 'funcName' ); - It is especially useful to var_dump ajax requests and will also show you on which …
<?php
// Add the snippet below in the file wp-config.php right above: /* That's all, stop editing! Happy blogging. */
define('WP_DEBUG', true );
if ( WP_DEBUG )
{
define('SAVEQUERIES', true );
@indikatordesign
indikatordesign / functions.php
Last active September 9, 2017 09:55
[Shortcode-Finder]Fork of the shortcode-finder described by wpbeginner.com
<?php
// This is a fork of the shortcode-finder described in this useful post: http://www.wpbeginner.com/wp-tutorials/how-to-find-and-remove-unused-shortcodes-from-wordpress-posts/
// Just add the snippet in your themes functions.php. You can use this shortcode in a post or page, as shown in the following example:
// [find_shortcode name='et_pb_dfbm_blog']
add_shortcode( 'find_shortcode', function( $atts, $content = false )
{
@indikatordesign
indikatordesign / functions.php
Last active July 26, 2023 15:05
[WooCommerce Subscriptions]Disallow downgrading for "WooCommerce Subscriptions" Grouped Product-Subscriptions
<?php
// Prevent Downgrading
add_filter( 'woocommerce_subscriptions_switch_is_identical_product', function( $is_identical_product, $product_id, $quantity, $variation_id, $subscription, $item )
{
if ( wc_get_product( (int) $product_id )->get_price() < $item->get_product()->get_price() )
{
$is_identical_product = true;
@indikatordesign
indikatordesign / open-mail.js
Last active September 9, 2017 10:01
[Mask email]Trigger to open email-client by clicking on an image using jQuery.
(function($){
$(function(){
"use strict";
$( '#e-placeholder' ).find( 'img' ).on( 'click', function()
{
var link = $( '<a />',
{
id : 'e-remove',
href : 'mailto:my-mail@my-domain.com?Subject=I want to get in touch with you!&body=My message to you.',
@indikatordesign
indikatordesign / class-license.php
Last active December 30, 2017 14:08
[Indikator Design - EMP License Key Registration] Needs to run in WordPress
<?php
/**
* Do not allow direct access
*
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) die( 'Don\'t try to load this file directly!' );
/**
* Indikator Design - EMP License Key Registration
@indikatordesign
indikatordesign / functions.php
Last active November 5, 2021 01:29
[Combine "Divi - Filterable Blog Module" with the "Events Manager" plugin]
<?php
// Here you can see how to combine "Divi - Filterable Blog Module" with the free plugin "Events Manager": https://wordpress.org/plugins/events-manager/
// Just add these snippets to your themes functions.php and change them according to your needs.
// Combine Event Manager with "Divi – Filterable Blog Module" by changing the $query_args
// If you use it like this, the sorting starts with the current event and past events will be hidden automatically
add_filter( 'dfbm_query_args_output', function( $query_args )
{
@indikatordesign
indikatordesign / functions.php
Last active November 5, 2021 01:28
[Divi - Change the order for the default filterable portfolio module]
<?php
// Add this snippet to your themes "functions.php" to order the projects by title
add_action( 'parse_query', function( $vars )
{
if ( 'project' == $vars->query['post_type'] )
{
@indikatordesign
indikatordesign / functions.php
Last active March 15, 2018 19:34
[Divi Layout Shortcode]
<?php
// Add layouts to the Divi library and get the ID from the corresponding URL
// To get your results, you can add a shortcode to text fields as follows: [divi-layout id="7"]
add_shortcode( 'divi-layout', function( $atts )
{
$atts = shortcode_atts( [ 'id' => '', ], $atts );