Skip to content

Instantly share code, notes, and snippets.

@svebal
svebal / .htaccess
Created July 12, 2023 10:50
protect wp-debug.log from public access
//Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
//Prevent directory listings
Options All -Indexes
<Files debug.log>
@svebal
svebal / wp-customizer-Control_select.php
Last active July 22, 2021 03:41
WP Customizer Control for Select field
<?php
$wp_customize->add_setting( 'themeslug_select_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_select',
'default' => 'option1',
) );
$wp_customize->add_control( 'themeslug_select_setting_id', array(
'type' => 'select',
let isIPadOs = function() {
return window.AuthenticatorAssertionResponse === undefined
&& window.AuthenticatorAttestationResponse === undefined
&& window.AuthenticatorResponse === undefined
&& window.Credential === undefined
&& window.CredentailsContainer === undefined
&& window.DeviceMotionEvent !== undefined
&& window.DeviceOrientationEvent !== undefined
&& navigator.maxTouchPoints === 5
&& navigator.plugins.length === 0
@svebal
svebal / pluginLoaded.js
Created September 17, 2018 20:29 — forked from siamkreative/pluginLoaded.js
Check if a jQuery plugin is loaded. If not, load it using the $.getScript() function.
jQuery(document).ready(function ($) {
'use strict';
function initModal() {
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
@svebal
svebal / Readme.md
Last active October 25, 2021 13:15 — forked from vishalbasnet23/Readme.txt
Custom Activation Link on Sign Up WordPress

Step by step guide.

First Phase:

  1. First create a html form with first name, last name and email field for signing up process.( Remember the action of the form it has to be the page slug of email confirmation page that you will be creating at in next phase. )

Second Phase:

  1. Create a Page ( Remember the slug has to be the same of that of action of the form of phase one ) and assign the template "template-confirmation-mail.php"
  2. This page is responsible for generating unqiue hash key and sending that hash key along with the user's new account credentials to their email.
  3. Remember the link of the activation_link has to the link to the email-verification template, which we will be creating in next phase.
@svebal
svebal / material_icons_unicode.css
Created March 4, 2018 12:03
unicodes of material icons
/*
* CSS File of Material icons.
* CSS code based on:
* https://google.github.io/material-design-icons/#icon-font-for-the-web
*/
/* Use the font
* download the font files from here: https://github.com/google/material-design-icons/tree/master/iconfont
* replace the url with your path
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body{
background: #fff;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body{
background: #fff;
}
@svebal
svebal / allow-html-in-widget-title.php
Last active October 10, 2017 19:09
[Wordpress] allow HTML tags in widget titles
<?php
// allow HTML tags in widget title
function html_widget_title( $var) {
$var = (str_replace( '[', '<', $var ));
$var = (str_replace( ']', '>', $var ));
return $var ;
}
add_filter( 'widget_title', 'html_widget_title' );
@svebal
svebal / svebal_custom_css_class.php
Last active October 10, 2017 11:51
[WordPress] adding custom css classes to body or posts
<?php
/**
* to body of one page
* https://developer.wordpress.org/reference/functions/body_class/
**/
function svebal_custom_body_class_v1( $classes ) {
if ( is_page( 'page-1' ) ) {
$classes[] = 'own-class';
}