Skip to content

Instantly share code, notes, and snippets.

Edward Edwardtonnn

Block or report user

Report or block Edwardtonnn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
<?php
function currentYear( $atts ){
return date('Y');
}
add_shortcode( 'year', 'currentYear' );
//To use the shortcode
[year]
@Edwardtonnn
Edwardtonnn / functions.php
Created May 15, 2019
Enqueue Style the simple way
View functions.php
<?php
// To enqueue style.css
wp_enqueue_style( 'style', get_stylesheet_uri() );
@Edwardtonnn
Edwardtonnn / index.html
Created May 14, 2019
Popup Maker Shortcode Example
View index.html
[popup_trigger id="49644" tag="span" class="download-button"]Download Now[/popup_trigger]
View functions.php
<?php
// Breadcrumbs
function custom_breadcrumbs() {
// Settings
$separator = '&gt;';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumbs';
$home_title = 'Homepage';
@Edwardtonnn
Edwardtonnn / custom.js
Last active Mar 28, 2019
enqueue scripts
View custom.js
(function($) {
// $ Works! You can test it with next line if you like
console.log("Custom JS Running");
})( 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
You can’t perform that action at this time.