Skip to content

Instantly share code, notes, and snippets.

Rob Orr roborracle

Block or report user

Report or block roborracle

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
@roborracle
roborracle / .htaccess
Created Apr 1, 2019
Keep those who are testing your security fences at bay by disallowing unauthorized access to your wp-config.php file. Add the following code to your .htaccess file
View .htaccess
<files wp-config.php>
order allow,deny
deny from all
</files>
View functions.php
<?php
// here is part of what I've got in my functions.php
function add_hooks_outside_structural_wraps() {
$structural_wraps = array(
'header',
'menu-primary',
'menu-secondary',
'site-inner',
@roborracle
roborracle / functions.php
Created Jan 13, 2017
Removing loop and markup from Genesis Framework home page
View functions.php
//Removing loop from home page and associated markup
function remove_homepage_content() {
if ( is_front_page() ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_filter( 'genesis_markup_site-inner', '__return_null' );
add_filter( 'genesis_markup_content-sidebar-wrap_output', '__return_false' );
add_filter( 'genesis_markup_content', '__return_null' );
}
}
@roborracle
roborracle / template.php
Last active Feb 21, 2018
Using Advanced Custom Fields plugin with Font Awesome to create a simple social connections link on a WordPress site.
View template.php
<div class="social">
<ul class="menu simple rdo-social">
<?php if( get_field('facebook') ): ?>
<li><a href="<?php echo the_field('facebook'); ?>"><i class="fa fa-facebook"></i></a></li>
<?php endif; ?>
<?php if( get_field('twitter') ): ?>
<li><a href="<?php echo the_field('twitter'); ?>"><i class="fa fa-twitter"></i></a></li>
<?php endif; ?>
<?php if( get_field('linkedin') ): ?>
<li><a href="<?php echo the_field('linkedin'); ?>"><i class="fa fa-linkedin"></i></a></li>
@roborracle
roborracle / MYTHEME.info
Last active Jan 6, 2016
How to print the search form in Drupal 7 for custom theme
View MYTHEME.info
// add a new region to your MYTHEME.info file
regions[top_bar_wrap] = Main Top Bar Block
// add the php to your THEMEPAGE.tpl.php in this example i've added as follows
<section class="top-bar-section">
<div class="my-class-main-nav hide-for-small-only"> // these are my classes, you can add yours as needed
<?php print render($page['top_bar_wrap']); ?>
</div>
@roborracle
roborracle / masonry-grid-foundation-5
Last active Oct 2, 2015
Using Foundation 5 in conjunction with jquery masonry to create a custom grid layout of recent posts in a WordPress site with trimmed titles, and trimmed post output.
View masonry-grid-foundation-5
<div class="row">
<div class="small-12 columns">
<div id="masonry-grid">
<?php
$args = array( 'numberposts' => '99' );
$recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ) {
if($recent['post_status']=="publish"){
echo '<div class="gutter-sizer"></div>
<div class="medium-4 small-12 grid-item columns">'
View genesis_custom_header.php
remove_action( 'genesis_after_header', 'genesis_do_nav' );
remove_action( 'genesis_header', 'genesis_do_header' );
function mysite_header(){ ?>
<div id="title-area"><div class="wrap"?>
<div class="one-sixth first mysite-title">
<h1><a href="<?php bloginfo('url'); ?>"><img src="http://mysite.com/mysite/wp-content/themes/mysite_theme/images/mysite-logo.png" width="250" class="mysite-logo" title="<?php $bloginfo = get_bloginfo( $show, $filter ); echo $bloginfo; ?>" /></a></h1>
</div>
<div class="four-sixths mysite-nav">
You can’t perform that action at this time.