Skip to content

Instantly share code, notes, and snippets.

View B1-0S's full-sized avatar

Dimitar Radev B1-0S

View GitHub Profile
@B1-0S
B1-0S / slideout.js
Last active April 16, 2021 17:42
Slideout.JS with fixed Passive Listeners
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Slideout = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';
/**
* Module dependencies
*/
var decouple = require('decouple');
var Emitter = require('emitter');
/**
/*
* Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
* Does not work for CPT!
*/
function rd_duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');
}
@B1-0S
B1-0S / product.php
Last active April 18, 2018 19:47
WordPress: Add Custom Post Type Product and Products Categories Taxonomy
<?php
/**
* Register product custom post type
* @return void
*/
function alcolock_product_cpt() {
$labels = array(
'name' => _x( 'Products', 'Post Type General Name', 'alcolock' ),
@B1-0S
B1-0S / Activating WooCommerce Lightbox, Gallery Slider, Zoom
Created September 5, 2017 11:38
Activating WooCommerce Lightbox, Gallery Slider, Zoom is quite simple by adding:
@B1-0S
B1-0S / Word Press Cheat Sheet
Created September 3, 2017 21:21
This is the alpha version of my WordPress Cheat Sheet. I hope you will find this one helpful.
Theme Files
style.css – This is your theme’s stylesheet file.
index.php – This is the main body template for your theme. Its job is to bring together all the information in the other theme files using template tags.
header.php – This file contains the header information that appears with the <head> section of your site, stuff like metadata and the link to your stylesheet.
sidebar.php – Everything in you sidebar goes in this file, like widgets, categories, additional menus, search form, etc.
footer.php – This file contains your footer information, such as copyright details, widgets, and social icons.
single.php – This file displays just one post.
page.php – When you create a page on your site, this is the template responsible.
comments.php – This file is responsible for displaying comments.
@B1-0S
B1-0S / make_slug.php
Created November 15, 2015 22:20 — forked from meSingh/make_slug.php
Create WordPress like slugs from any string in php.
<?php
/**
*
* Genrate Slugs from Title or any given string
*
* @param string $str
* @return Slug
*
**/