Skip to content

Instantly share code, notes, and snippets.

View victorknust's full-sized avatar
🏠
Working from home

Victor knust victorknust

🏠
Working from home
View GitHub Profile
@victorknust
victorknust / basichook.php
Created February 29, 2016 16:29 — forked from danielpataki/basichook.php
Getting Started With Plugins
function my_tracking_code() {
echo 'Paste tracking code from Google Analytics here';
}
add_action( 'wp_footer', 'my_tracking_code' );
@victorknust
victorknust / cookie-get
Created February 29, 2016 14:18 — forked from midoriberlin/cookie-get
Retrieving a cookie
@victorknust
victorknust / delete-cookie
Created February 29, 2016 14:18 — forked from midoriberlin/delete-cookie
Deleting a cookie
@victorknust
victorknust / footer.php
Created February 25, 2016 20:00 — forked from gagan0123/footer.php
Social Links
<?php
/*
* Plugin Name: dropkick
* Plugin URI: http://d8c.us/
* Description: Rewrite local image locations to dropbox locations
* Version: 0.2
* Author: Jonas M Luster <j@d8c.us>
* Author URI: http://feastcraft.com
* License: GPL3
* */
@victorknust
victorknust / backup.sh
Created February 25, 2016 19:49 — forked from codeablehq/backup.sh
A script that creates a backup of your WordPress site and uploads it to Dropbox
#!/bin/bash
# For this script to work, save it somewhere in the executable path, like /usr/local/sbin/backup.sh
# make it executable: chmod +x /usr/local/sbin/backup.sh
# then add it to cron: crontab -e
# and add the line below, which will run backup 3am each day, then upload to Dropbox
# 0 3 * * * /usr/local/sbin/backup.sh > /dev/null 2>&1
# You also need WP CLI installed: http://wp-cli.org/
@victorknust
victorknust / wp_magic_quotes.php
Created February 25, 2016 18:59 — forked from eddy8/wp_magic_quotes.php
PHP:wp functions - wp_magic_quotes
<?php
/**
* Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
*
* Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
* or $_ENV are needed, use those superglobals directly.
*
* @access private
* @since 3.0.0
*/
@victorknust
victorknust / .htaccess
Created February 25, 2016 18:55
WP security
# Set .htpasswd for wp-admin. Place this code in .htaccess within wp-admin folder.
AuthType Basic
AuthName "Your prefered name"
AuthUserFile /path/to/.htpasswd # Path must be absolute.
Require user user1 user2 user3
# Deny access to wp-config.php file.
<Files wp-config.php>
Order allow, deny
Deny from all
@victorknust
victorknust / contactform.php
Created February 25, 2016 18:54 — forked from INDIAN2020/contactform.php
contact wp
<?php
/*
Plugin Name: Simple Contact Form Shortcode
Plugin URI: http://wp.tutsplus.com/author/barisunver/
Description: A simple contact form for simple needs. Usage: <code>[contact email="your@email.address"]</code>
Version: 1.0
Author: Barış Ünver
Author URI: http://beyn.org/
*/
@victorknust
victorknust / list-recent-posts
Created February 17, 2016 16:17 — forked from raewrites/list-recent-posts
List of Recent Posts
<?php
$args = array(
'posts_per_page' => '4',
'exclude' => array( $post->ID )
);
// get posts
$posts = get_posts( $args );
// check if any posts are returned
if ( $posts ) { ?>