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
<ifmodule mod_deflate.c> | |
# Compress HTML, CSS, JavaScript, Text, XML and fonts | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
AddOutputFilterByType DEFLATE application/x-font | |
AddOutputFilterByType DEFLATE application/x-font-opentype | |
AddOutputFilterByType DEFLATE application/x-font-otf |
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
find . -type f -mtime 0 ! -path '*/cache/*' ! -path '*/vendor/*' ! -path '*/uploads/*' ! -path '*/log/*' |
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 add_login_logout_to_menu( $items, $args ) { | |
if ( $args->theme_location != 'primary' ) { | |
return $items; | |
} | |
if ( !is_user_logged_in() ) { | |
$items .= '<li><a href="'.wp_login_url().'" title="Login">Login</a></li>'; | |
} else { | |
$current_user = wp_get_current_user(); | |
$items .= '<li class="menu-item-has-children"><a href="#">'. $current_user->display_name .'</a><ul class="sub-menu">'; |
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 | |
if($_SERVER['REMOTE_ADDR'] == 'x.x.x.x') { | |
$user_id = 1; | |
$user = get_user_by( 'id', $user_id ); | |
if( $user && !is_user_logged_in()) { | |
wp_set_current_user( $user_id, $user->user_login ); | |
wp_set_auth_cookie( $user_id ); | |
do_action( 'wp_login', $user->user_login, $user ); | |
} | |
} |
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
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
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 | |
//SQL | |
$mydb = new wpdb('root','root','magento','localhost'); | |
$rows = $mydb->get_results(" | |
select p.entity_id, p.sku, f.title, f.uploaded_file | |
from pml_uni_fileuploader f | |
inner join pml_catalog_product_entity p | |
on find_in_set(p.entity_id, f.product_ids) | |
order by p.entity_id |
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 get_replaced_sourcecode_sc( $post ) { | |
if ( empty($post) ) global $post; | |
if ( empty($post) || ! isset($post->post_content) ) return false; | |
$content = $post->post_content; | |
if ( | |
preg_match_all( '/'. get_shortcode_regex() .'/s', $post->post_content, $matches ) | |
&& array_key_exists( 2, $matches ) && in_array( 'purehtml', $matches[2] ) | |
) { | |
foreach ( $matches[2] as $i => $sc ) { | |
if ( $sc == 'purehtml' ) |
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
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; | |
CREATE DATABASE newdatabase; | |
GRANT ALL PRIVILEGES ON newdatabase.* TO 'newuser'@'localhost'; |
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
1. Networking / Add Domain or Create new A record for subdomain; | |
2. cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf | |
3. vi /etc/apache2/sites-available/example.com.conf | |
----------- | |
<VirtualHost *:80> | |
ServerAdmin admin@example.com | |
DocumentRoot /var/www/example.com | |
ServerName example.com |
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
// assets/scripts/customizer.js | |
(function($) { | |
// Primary colour | |
wp.customize('primary_colour', function(value) { | |
value.bind(function(to) { | |
$('head').append('<style>.Primary-bg-c{background-color:'+ to +' !important;}</style>'); | |
$('head').append('<style>.Primary-c{color:'+ to +' !important;}</style>'); | |
$('head').append('<style>.Primary-c--hover:hover{color:'+ to +' !important;}</style>'); |
NewerOlder