Skip to content

Instantly share code, notes, and snippets.

View geoffduke's full-sized avatar

Geoff Duke geoffduke

View GitHub Profile
@geoffduke
geoffduke / footer1.php
Last active October 15, 2018 15:24
Wordpress Dynamic Footer
<!-- In the functions file first add the footer menu location function -->
function band_features(){
register_nav_menu('footerLocationOne', 'Footer Location One');
};
add_action('after_setup_theme', 'band_features');
<!-- in the footer page add where required -->
?>
@geoffduke
geoffduke / header.php
Last active October 15, 2018 15:04
Wordpress Header HTML - Custom Body function and navbar barebones
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset') ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<?php wp_head(); ?>
</head>
@geoffduke
geoffduke / wp-social-login.php
Created October 15, 2018 14:13 — forked from technoknol/wp-social-login.php
wordpress login with social sites
<?php
/*****************************
This is a tweak to customize your wordpress login to allow login with Other Social Sites like Google,Facebook,Twitter,LinkedIn etc...
**********************************/
// To enable social logins in your wordpress website
@geoffduke
geoffduke / wordpress-functions.php
Created October 15, 2018 14:11 — forked from deardorffdev/wordpress-functions.php
Useful Wordpress Functions 1
<!-- What is Functions File in WordPress? -->
<!-- Functions file commonly known as functions.php file is a WordPress theme file.
It comes with all free and premium WordPress themes.
The purpose of this file is to allow theme developers to define theme features and functions. This file acts just like a WordPress plugin and can be used to add your own custom code snippets in WordPress.
You would find many of these code snippets on websites like https://deardorffassociatesweb.wordpress.com/ with instructions telling you to add this code in your theme’s functions.php file or a site-specific WordPress plugin.
Now you may be thinking what’s the difference between a site-specific WordPress plugin and functions.php file? Which one is better?
@geoffduke
geoffduke / page.php
Created October 15, 2018 14:06
Adding breadcrumb and side menus to WP_Themes
<!-- breadcrumb -->
<?php
$theParent = wp_get_post_parent_id(get_the_ID());
if ($theParent) { ?>
<div class="metabox metabox--position-up metabox--with-home-link">
<p><a class="metabox__blog-home-link" href="<?php echo get_permalink($theParent); ?>"><i class="fa fa-home" aria-hidden="true"></i> Back to <?php echo get_the_title($theParent); ?></a> <span class="metabox__main"><?php the_title(); ?></span></p>
</div>
<?php }
?>
@geoffduke
geoffduke / forloop.js
Last active August 7, 2018 11:50
Typical Mouse event forloop
var lis = document.querySelectorAll("li");
for(var i = 0; i < lis.length; i++){
lis[i].addEventListener("mouseover", function () {
this.style.color = "green";
});
lis[i].addEventListener("mouseout", function () {
this.style.color = "black";
});
};