Skip to content

Instantly share code, notes, and snippets.

@sebgates
sebgates / Protect wp-login.php
Last active August 29, 2015 14:01
Code for adding at the top of your .htaccess file to create encrypted password before wp-login.php
ErrorDocument 401 "Unauthorized Access! You need to provide valid credentials to login"
ErrorDocument 403 "Forbidden! You're not allowed to access this page."
<Files "wp-login.php">
AuthName "Administrators Only!"
AuthType Basic
AuthUserFile /home/username/wplogin
require valid-user
</Files>
function modify_jquery() {
if ( !is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js', false, '1.8.1' );
wp_enqueue_script( 'jquery' );
}
}
add_action( 'init', 'modify_jquery' );
function add_jquery() {
wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'add_jquery' );
function add_jquery_ui() {
wp_enqueue_script('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js', false, '1.8.8');
}
add_action( 'init', 'add_jquery_ui' );
function add_jquery_ui() {
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-mouse' );
wp_enqueue_script( 'jquery-ui-accordion' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
wp_enqueue_script( 'jquery-ui-slider' );
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-draggable' );
@sebgates
sebgates / Responsive Video CSS
Last active December 27, 2018 17:36
Responsive Video CSS
//Copy this CSS in to your style sheet //
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 0px;
height: 0;
overflow: hidden;
}
@sebgates
sebgates / Adding mp3 audio to a button in Bootstrap
Created March 3, 2016 15:56
Adding mp3 audio to a button in Bootstrap
<!--Add this code to your website and change the audio file name accordingly -->
<audio id="sound1" src="audio/sound1.mp3" preload="auto"></audio>
<button onclick="document.getElementById('sound1').play();">Play
it</button>
<?php
if (isset($_GET)){
$error_message = $_GET["error_message"];
} else{
$error_message = "";
}
?><!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
<?php
if (empty($_POST)){
header("location:index.php"); #redirect to the index page
}
//get the data from the form
$product_description = $_POST["product_description"];
$list_price = $_POST["list_price"];
$discount_percent = $_POST["discount_percent"];
if (!is_numeric($list_price) || !is_numeric($discount_percent)) {
if (!is_numeric($list_price)) {
<?php
$first_name = "Victor";
$year_of_birth = 1974;
echo $first_name;
echo "<br>";
echo $year_of_birth;
echo "<br>";
echo $first_name . " " . $year_of_birth;
echo "<br>";