Skip to content

Instantly share code, notes, and snippets.

View loorlab's full-sized avatar
💻
💥👩‍🚀👨‍🚀💥

LOOR Lab loorlab

💻
💥👩‍🚀👨‍🚀💥
View GitHub Profile
@loorlab
loorlab / custom-wp-dashboard.php
Created April 17, 2016 19:21 — forked from arod2634/custom-wp-dashboard.php
Customize Wordpress Admin Dashboard
<?php
//Add a custom admin dashboard welcome widget
function custom_dashboard_widget() {
echo '<h1>Welcome to your new WordPress site built by an awesome developer</h1>';
}
function add_custom_dashboard_widget() {
wp_add_dashboard_widget('custom_dashboard_widget', 'Integrity Welcomes You To WordPress!', 'custom_dashboard_widget');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');
@loorlab
loorlab / .htaccess
Created April 27, 2016 20:18 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
<!-- adding Contact Form 7 into Wordpress Template and removing <br> tags
add the following to the wordpress template -->
<?php echo do_shortcode('[contact-form-7 id="211" title="Spanish Contact Form"]') ; ?>
<!-- add the following into the wp-config.php -->
define ('WPCF7_AUTOP', false );
<!-- This will remove the <br> tags that get added automatically when you call Contact Form 7 from the template via shortcode-->
@loorlab
loorlab / load_page_specific_css_js_WP.php
Last active May 27, 2016 14:09 — forked from baczoni/gist:2479987
WordPress: Page specific css and javascript
//Page specific css and/or javascript -- Add to header.php
<?php
if (is_page_template('page-archives.php')) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/ archives.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/ js/archives.js"></script>
<?php }
/** Remove jQuery scripts from begining */
add_action('wp_enqueue_scripts', 'wbxp_script_remove_header');
function wbxp_script_remove_header() {
wp_deregister_script( 'jquery' );
}
/** Load jQuery script at the end */
add_action('genesis_after_footer', 'wbxp_script_add_body');
function wbxp_script_add_body() {
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, null);
@loorlab
loorlab / functions.php
Created September 11, 2016 18:45 — forked from schilke/functions.php
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
@loorlab
loorlab / wordpress-sql-queries.SQL
Created September 12, 2016 00:01 — forked from manfromanotherland/Wordpress-Database-Overview.md
Useful WordPress SQL Queries
/*
Useful WordPress SQL Queries
*/
/*
Add a Custom Field to All Posts & Pages
---
This snippet will add a custom field to every post and page found in your
WP database. All you have to do is replace the UniversalCutomField to
whatever Custom Field name you like to create, and then change
@loorlab
loorlab / custom-login.css
Created September 16, 2016 17:22 — forked from mateusneves/custom-login.css
WordPress custom login style
/* Change background */
body.login {
background-image: url('home-bg.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
/* Change login logo */
.login h1 a {
@loorlab
loorlab / functions.php
Created September 19, 2016 01:27 — forked from yoren/functions.php
Parent Post From Another Post Type And A New URL Structure In WordPress
<?php
// Flush rewrite rules after switch theme
function my_rewrite_flush() {
flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'my_rewrite_flush' );
// A little help so we can get the stylesheet from parent theme
// Remove line 10-19 if this is not a child theme
function my_enqueue_styles() {