This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function http_auth_headers(){ | |
header('WWW-Authenticate: Basic realm="Web Page Restricted"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
echo 'You must enter the correct credentials to access this page'; | |
exit; | |
} | |
add_action('template_redirect', 'add_http_auth_basic', 0); | |
function add_http_auth_basic(){ | |
$uri = 'contact'; | |
if(!is_admin()){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hide_from_everyone() { | |
if( !is_admin() && !is_user_logged_in() ){ | |
die(); | |
} | |
} | |
add_action( 'template_redirect', 'hide_from_everyone' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<!-- created by Jess - jessnunez.dev --> | |
<meta charset="UTF-8" /> | |
<title>Simple Password Generator</title> | |
<meta name="description" content="A quick and easy password generator. No muss, no fuss."/> | |
<meta name="viewport" content="width=device-width" /> | |
<link rel="icon" href="icon.png" /> | |
<link href="https://fonts.googleapis.com/css?family=Cutive+Mono&display=swap" rel="stylesheet"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_remove_php_test( $tests ) { | |
unset( $tests['direct']['php_extensions'] ); | |
unset( $tests['async']['background_updates'] ); | |
return $tests; | |
} | |
add_filter( 'site_status_tests', 'prefix_remove_php_test' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS"); | |
if( $iPod || $iPhone || $iPad){ | |
header( 'Location: https://facebook.com' ); | |
die(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// APPLY QUERY VAR TO SPECIFIC QUERY AUTOMATICALLY | |
function jess_apply_filter_automatically($query) { | |
if ( is_front_page() && in_array ( $query->get('post_type'), array('events') ) ) { | |
$query->set('jess_random_posts', 3); | |
$query->set('posts_per_page', -1); | |
} | |
} | |
add_action( 'pre_get_posts', 'jess_apply_filter_automatically' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RANDOMIZE A SPECIFIC NUMBER OF POSTS | |
add_filter( 'the_posts', function( $posts, \WP_Query $query ) | |
{ | |
if( $random = $query->get( 'jess_random_posts' ) ) | |
{ | |
shuffle( $posts ); | |
$posts = array_slice( $posts, 0, (int) $random ); | |
} | |
return $posts; | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'wp-load.php'; | |
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); | |
/* check connection */ | |
if (mysqli_connect_errno()) { | |
printf("Connect failed: %s\n", mysqli_connect_error()); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Store the file post_ids as a variable | |
POST_IDS=$(<post_ids) | |
# Loop through each of these IDs | |
for POST_ID in $POST_IDS | |
do | |
wp-cli post term set "$POST_ID" category uncategorized --path=/htdocs/__wp__ |
NewerOlder