Skip to content

Instantly share code, notes, and snippets.

// wp_html_compression
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link.
remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link.
remove_action('wp_head', 'wp_generator'); //removes meta name generator.
remove_action('wp_head', 'wp_shortlink_wp_head'); //removes shortlink.
remove_action('wp_head', 'feed_links', 2 ); //removes feed links.
remove_action('wp_head', 'feed_links_extra', 3 ); //removes comments feed.
remove_action('wp_head', 'wp_resource_hints', 2 ); // remove WP 4.9+ dns-prefetch
remove_action('wp_head', 'print_emoji_detection_script', 7 ); // remove WP 4.2+ emoji
remove_action('admin_print_scripts', 'print_emoji_detection_script' ); // remove WP 4.2+ emoji
remove_action('wp_print_styles', 'print_emoji_styles' ); // remove WP 4.2+ emoji
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@ai2ik
ai2ik / Delete old wp posts
Last active August 1, 2018 19:45
Delete old wp posts by date
function get_delete_old_post()
{
// WP_Query arguments
$args = array(
'fields' => 'ids', // Only get post ID's to improve performance
'post_type' => array(
'post'
) , //post type if you are using default than it will be post
@ai2ik
ai2ik / c-engine.php
Created October 18, 2017 14:47
Bulletproof simple contact form
<!-- Add this form to your webpage -->
<form method="post" action="c-engine.php" class="form">
<div class="form-group">
<input type="text" name="Name" id="Name" class="form-control" placeholder="Your Name">
</div>
<div class="form-group">
<input type="text" name="Phone" id="Phone" class="form-control" placeholder="Phone Number">
</div>
<div class="form-group">
<?php /* Template Name: Custom Template */ ?>
<?php get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
@ai2ik
ai2ik / functions.php
Created August 10, 2017 15:48
WP functions for Child theme
<?php
//* Code goes here
add_action('wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
?>
@ai2ik
ai2ik / style.css
Last active October 1, 2018 18:30
WP Child theme CSS
/*
Theme Name: Child Theme
Template: wp-bootstrap-starter
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/favicon.ico">
newsmutiny.com
www.collective-evolution.com
realnewsrightnow.com
thedcgazette.com
addictinginfo.org
www.activistpost.com
www.duffelblog.com
70news.wordpress.com
naturalnews.com
www.coasttocoastam.com