Skip to content

Instantly share code, notes, and snippets.

View raazon's full-sized avatar
❤️
Eat - Sleep - Code

Razon Komar Pal raazon

❤️
Eat - Sleep - Code
View GitHub Profile
@raazon
raazon / production.yml
Created April 15, 2022 13:33
GitHub Action for deploying code via rsync over ssh https://github.com/Burnett01/rsync-deployments
name: 🚀 Production rsync deployment by SSH/SFTP
on:
push:
branches: [ main ]
jobs:
build:
name: Build
@raazon
raazon / regex-for-wp-redirect.php
Last active December 13, 2020 08:03
Redirect if specific slug found in URL PHP / Redirect if specific slug not found in URL PHP
<?php
/*
* Redirect if specific slug "hello-world OR hello-regex" not found in URL
*/
add_action('template_redirect', 'ic_icredirection');
function ic_icredirection()
{
if (!is_user_logged_in()) {
$regex = '/^(?:(?!\/(?:hello-world|hello-regex)(?:\/|$)).)*$/m';
@raazon
raazon / elementor-assign-category-snippet.php
Created December 12, 2020 17:49 — forked from obiPlabon/elementor-assign-category-snippet.php
Asssign any elementor widget to a different category
<?php
/**
* Asssign any elementor widget to a different category
*
* To override the existing category just pass [ 'your-custom-category' ]
* And to keep existing [ 'your-custom-category', 'basic' ]
* here 'your-custom-category' is any registered category slug
*
* @param array $config
@raazon
raazon / elementor-disable-all-wp-widgets.php
Created December 12, 2020 17:49 — forked from obiPlabon/elementor-disable-all-wp-widgets.php
Disable or remove elementor widget from editor panel
<?php
/**
* Disable elementor registered widget.
*
* This will disable all WordPress native widgets
*
* @param \Elementor\Widgets_Manager $widgets_manager Instance of elementor widgets manager
*
* @author obiPlabon <https://obiPlabon.im>
*
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
function my_custom_query_vars( $vars ) {
$vars[] = 'refunds-returns';
@raazon
raazon / README.md
Created November 23, 2020 07:23 — forked from ControlledChaos/README.md
Sanitization of WordPress Customizer controls

Sanitize the WordPress Customizer

WordPress Snippets

/**
* Adding custom icon to icon control in Elementor
*/
function jet_add_custom_icons_tab( $tabs = array() ) {
// Append new icons
$new_icons = array(
'account',
'airplane',
'wordpress',
@raazon
raazon / admin-ssl-vesta.sh
Created November 10, 2020 19:34 — forked from hasinhayder/admin-ssl-vesta.sh
Install Admin Panel SSL Cert for VestaCP using LetsEncrypt
v-change-sys-hostname somedomain.com
v-add-letsencrypt-domain 'admin' $HOSTNAME '' 'yes'
# v-add-letsencrypt-domain 'admin' $HOSTNAME '' 'no'#mail domain = no
v-update-host-certificate admin $HOSTNAME
echo "UPDATE_HOSTNAME_SSL='yes'" >> /usr/local/vesta/conf/vesta.conf
// Less project settings, you can edit it and set custom settings.
{
// The mappings of source directory and output directory
"mappings": [
{
"src": "styles/main.less",
"dest": "css/main.css"
},
{
"src": "js/main.js",
@raazon
raazon / push-notification.js
Created September 19, 2020 00:14
HTML5 Browser Push Notification
function askForApproval(title = '', content = '', icon = '', url = '') {
if(Notification.permission === "granted") {
createNotification(
title,
content,
icon,
url
);
}
else {