Skip to content

Instantly share code, notes, and snippets.

View isuke01's full-sized avatar

Łukasz ISU Biedroń isuke01

View GitHub Profile
@isuke01
isuke01 / t2-check-feature-exists.php
Last active February 3, 2023 11:56
(WordPress/T2) Helper function to check if T2 feature is activated.
<?php
/**
* Helper functio nto check if there is T2 feature activated.
* Example usage: t2_is_feature_activated( 't2/newsletter' )
*
* @param string $feature The t2 feature e.g t2/newsletter.
* @return bool
*/
function t2_is_feature_activated( string $feature ): bool {
@isuke01
isuke01 / class-customizer.php
Last active February 2, 2023 11:33
WP add option to Customizer
<?php
/**
* Customizer additional settings.
* To retrive the setting use get_theme_mod( 'setting_name' )
*/
class Customizer {
/**
* Class instance.
*
* @var self
@isuke01
isuke01 / core-media-text.backend.inspector-control.js
Created January 11, 2023 13:17
Test Extend Core paragraph with footnote (just attribute)
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelBody, PanelRow, TextControl } from '@wordpress/components';
// eslint-disable-next-line import/no-extraneous-dependencies
import { InspectorControls } from '@wordpress/block-editor';
function InspectorControl({ attributes, setAttributes }) {
const { footnote } = attributes;
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array nota
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" lang="pl">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<!--[if IE 8]>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<![endif]-->
<script type="text/javascript" src="//static.cda.pl/js/layout_pack/layout_pack_no_uplv3.js?v=203bcd"></script>
<script type="text/javascript" src="//static.cda.pl/js/jquery.cookie.js"></script>
@isuke01
isuke01 / markdown-text-101.md
Created January 27, 2022 13:07 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__

@isuke01
isuke01 / taxonomy-terms-order.php
Last active June 17, 2021 11:23
Fix issue with Wordpres Multisite for Category Order and Taxonomy Terms Order.
<?php
/*
Plugin Name: Category Order and Taxonomy Terms Order
Plugin URI: http://www.nsp-code.com
Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability.
Version: 1.5.7.6
Author: Nsp-Code
Author URI: https://www.nsp-code.com
Author Email: electronice_delphi@yahoo.com
Text Domain: taxonomy-terms-order
@isuke01
isuke01 / wp-rewrite.php
Last active June 28, 2023 14:27
Change wordpress blog poss rewrite rules
<?php
/*
|--------------------------------------------------------------------------
| Fix for blog links
|--------------------------------------------------------------------------
| Add post type before single post name (fix post link on backend)
*/
function fix_blog_links($post_link, $post, $leavename) {
if($post->post_status === 'draft') return $post_link;
@isuke01
isuke01 / gutenberg_validation_acf_fix.php
Created March 7, 2020 10:09
Fix Gutenberg and ACF validation issue
function enhancement_gutenberg_isu(){
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
wp.domReady(function(){
//acf Custom Validation for Gutenberg
var postSaveButtonClasses = '.editor-post-publish-button';
$(document).on('click', postSaveButtonClasses , function(e){
e.stopPropagation();
@isuke01
isuke01 / gutenberg_validation_acf_fix.php
Created March 7, 2020 10:09
Fix Gutenberg and ACF validation issue
function enhancement_gutenberg_isu(){
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
wp.domReady(function(){
//acf Custom Validation for Gutenberg
var postSaveButtonClasses = '.editor-post-publish-button';
$(document).on('click', postSaveButtonClasses , function(e){
e.stopPropagation();