Skip to content

Instantly share code, notes, and snippets.

View Edwardtonnn's full-sized avatar
🎯
Focusing

Edward Edwardtonnn

🎯
Focusing
  • Los Angeles Web Club
  • South Gate, CA
View GitHub Profile
@Edwardtonnn
Edwardtonnn / functions.php
Created July 17, 2018 17:07
Conditionally Enqueue JS file to certain pages of WP site. Specifically, NOT enqueue certain pages on WP site
<?php
//Function to add custom.js functionality to header only if the page is NOT contact page
add_action( 'wp_enqueue_scripts', 'conditional_header');
function conditional_header(){
if(is_page('contact') == false){
wp_enqueue_script(
'custom',
get_stylesheet_directory_uri() . '/js/custom.js',
array('jquery'),
@Edwardtonnn
Edwardtonnn / index.html
Created July 17, 2018 17:53
Snazzy Maps Layout
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style type="text/css">
/* Set a size for our map container, the Google Map will take up 100% of this container */
#map {
width: 100%;
height: 350px;
}
</style>
@Edwardtonnn
Edwardtonnn / webdev_online_resources.md
Created July 23, 2018 18:17 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@Edwardtonnn
Edwardtonnn / functions.php
Created August 3, 2018 16:30
Adds multiple sidebars to any theme for WordPress
<?php
// Adds Widget Area
// Register Widgets
function custom_sidebar() {
register_sidebar(array(
'id' => 'my-new-widget',
'name' => __( 'My New Widget', 'text_domain' ),
'description' => __( 'This is my widget description.', 'text_domain' ),
@Edwardtonnn
Edwardtonnn / functions.php
Last active August 7, 2018 19:08
Enqueue Scroll Reveal js library
<?php
// Do not include opening php tag
//Scroll Reveal JS
add_action('wp_enqueue_scripts', 'load_scroll_reveal', 20);
if (is_front_page()){
// Scroll Reveal Main JS
wp_enqueue_script(
'scrollReveal',
! function ($) {
function getHashtag() {
var url = location.href;
return hashtag = -1 !== url.indexOf("#prettyPhoto") && decodeURI(url.substring(url.indexOf("#prettyPhoto") + 1, url.length)), hashtag && (hashtag = hashtag.replace(/<|>/g, "")), hashtag
}
function setHashtag() {
"undefined" != typeof theRel && (location.hash = theRel + "/" + rel_index + "/")
}
@Edwardtonnn
Edwardtonnn / functions.php
Created August 31, 2018 18:29
Loading Particles.js on WP website
<?php
//Particles JS
add_action('wp_enqueue_scripts', 'load_particles', 5);
function load_particles(){
// Particles JS
wp_enqueue_script(
'particles',
get_stylesheet_directory_uri() . '/js/particles.js',
array('jquery'),
<?php
Follow directions @ https://www.sitepoint.com/wordpress-svg/
<?php
add_action ('wp_enqueue_scripts', 'load_custom_styles');
function load_custom_styles() {
wp_enqueue_style(
'custom',
get_template_directory_uri() . '/css/custom.css'
);
wp_enqueue_script(
@Edwardtonnn
Edwardtonnn / .htaccess
Created September 25, 2018 19:28
rewrite site to subsolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
In the above lines you should replace the following:
domain-name.com - Type your own domain name
folder - Type the name of the subfolder which has the test/development website