Instantly share code, notes, and snippets.

Edward Edwardtonnn

View GitHub Profile
View custom.js
(function($) {
// $ Works! You can test it with next line if you like
// console.log($);
})( jQuery );
@Edwardtonnn
Edwardtonnn / functions.php
Last active Feb 1, 2019
Enqueu Style w Timestamp
View functions.php
<?php
function load_style(){
// How to load an external style
wp_enqueue_style('fonts-css', 'https://fonts.googleapis.com/css?family=Open+Sans|Valera+Round');
// How to load internal stylesheet
// Notice the get the time parameter near the end. This allows for clearly identifying when the css file has been loaded
// Only use get_the_time() when in development
wp_enqueue_style( 'main', get_stylesheet_uri(), ['font-css'], get_the_time());
@Edwardtonnn
Edwardtonnn / functions.php
Created Jan 25, 2019
Custome author name without creating new users
View functions.php
<?php
// This snippet allow you to add custom author names without having to create new user accounts.
// Simply place this snippet in the functions.php file.
// Viewing the post dashboard, navigate to the screen options dropdown (located top right of the screen)
// and enable custom fields.
add_filter( 'the_author', 'guest_author_name' );
add_filter( 'get_the_author_display_name', 'guest_author_name' );
@Edwardtonnn
Edwardtonnn / functions.php
Created Dec 18, 2018
Removes Guttenberg Block Editor
View functions.php
<?php
// As expected, Gutenberg is changing constantly. As of now,
// you can use either of the following filter hooks to disable Gutenberg completely on your entire site:
// disable for posts
add_filter('use_block_editor_for_post', '__return_false', 10);
// OR
@Edwardtonnn
Edwardtonnn / .htaccess
Created Dec 10, 2018
Force SSL on all pages
View .htaccess
<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]
</IfModule>
@Edwardtonnn
Edwardtonnn / .htaccess
Created Dec 2, 2018
Enables gzip via htaccess file
View .htaccess
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
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
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
@Edwardtonnn
Edwardtonnn / svg-support.js
Last active Nov 29, 2018
Add svg support for html img tag
View svg-support.js
/*
* Replace all SVG images with inline SVG
StackExchange thread:
https://stackoverflow.com/questions/11978995/how-to-change-color-of-svg-image-using-css-jquery-svg-image-replacement
*/
jQuery('img.icon-svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
@Edwardtonnn
Edwardtonnn / _functions.php
Last active Nov 27, 2018
Holy Grail Genesis Function Edits 2.0.0
View _functions.php
//* Customize Footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'custom_footer' );
function custom_footer() {
?>
<p>&copy; Copyright 2018 <a href="#">My Domain</a> &middot; All Rights Reserved &middot; Powered by <a href="http://wordpress.org/">WordPress</a> &middot; <a href="http://mydomain.com/wp-admin">Aline Inc.</a></p>
<?php
}
//* Remove the edit link
add_filter ( 'genesis_edit_post_link' , '__return_false' );
@Edwardtonnn
Edwardtonnn / index.html
Created Nov 13, 2018
Simple Fade In Effect
View index.html
<div class="container-about-us">
<ul class="white about-us">
<li><a href="#" class="text-a-about">Web Design</a></li>
<li><a href="#" class="text-a-about">Marketing</a></li>
<li><a href="#" class="text-a-about">SEO</a></li>
</ul>
</div>
@Edwardtonnn
Edwardtonnn / functions.php
Created Nov 5, 2018
Search text filter for Genesis Themes
View functions.php
<?php
//Change search form text
function themeprefix_search_button_text( $text ) {
return ( 'Search text goes here...');
}
add_filter( 'genesis_search_text', 'themeprefix_search_button_text' );