Skip to content

Instantly share code, notes, and snippets.

View barbwiredmedia's full-sized avatar

Barbara Talbot barbwiredmedia

View GitHub Profile
@barbwiredmedia
barbwiredmedia / roots_sidebar.txt
Created May 5, 2015 19:06
Wordpress roots/ sage theme , Roots_Sidebar , roots_display_sidebar
//Roots 7.0.3 and lower
//https://discourse.roots.io/t/sidebar-problem-with-custom-post-type/596/5
Change in lib/sidebar.php:
Line 18: public $display = true; (change to false)
Line 28: $this->display = false; (change to true)
Then the conditionals in lib/config.php will work in reverse. They will SHOW the sidebar based on the conditions listed
//Sage
@barbwiredmedia
barbwiredmedia / multisite-conditional.php
Last active February 18, 2021 11:05
Wordpress Multisite body class addition and blog conditional.
<?php global $blog_id; ?>
<?php if ($blog_id == 2) { ?>
<?php } elseif ($blog_id == 1) { ?>
<?php } ?>
// Add site-id class to body functions.php
add_filter('body_class', 'multisite_body_classes');
function multisite_body_classes($classes) {
$id = get_current_blog_id();
#your-slider .carousel-inner{
height: 500px;
}
#your-slider .carousel-inner>.active{
position: relative;
top: 50%;
transform: translateY(-50%);
}
#your-slider .carousel-inner>.next,
<!DOCTYPE html>
<html>
<head>
<title>Form polyfill</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="modernizr.custom.js"></script>
<script src="webshims/polyfiller.js"></script>
<script>
$.webshims.polyfill();
</script>
@barbwiredmedia
barbwiredmedia / admin_notice.php
Last active July 6, 2018 17:54
Wordpress admin notice added to functions. Classes include: updated - green , error - red, update-nag - yellow http://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices To create dismissable notices: http://wptheming.com/2011/08/admin-notices-in-wordpress/
function my_admin_notice() {
?>
<div class="error">
<p><?php _e( '3/13/2013 - ATTENTION! Please do not update the Custom Post Type UI Plugin. Versions 1.0.4. and lower are causing issues with content disappearing. Version 0.9.5 is stable and should remain active until futher notice. Please contact support with any questions.', 'my-text-domain' ); ?></p>
</div>
<?php
}
add_action( 'admin_notices', 'my_admin_notice' );
@barbwiredmedia
barbwiredmedia / ajax-redirect.php
Created March 5, 2015 18:41
PHP header location redirect if not ajax request. Used to hide a php page used for a script request
if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) )
{
// Your Script
} else {
header('Location: http://www.yourdomainname.com');
exit;
}
@barbwiredmedia
barbwiredmedia / layout_selection.php
Created February 17, 2015 22:32
Wordpress ACF Flexible content field, layout selection
<?php
// check if the flexible content field has rows of data
if (have_rows('choose_layout')):
// loop through the rows of data
while (have_rows('choose_layout')) : the_row();
if (get_row_layout() == 'general_content'):
?>
//
<?php elseif (get_row_layout() == 'block_quote'): ?>
//
@barbwiredmedia
barbwiredmedia / wp-config.php
Created February 11, 2015 17:38
Wordpress wp-config for local/dev live /production. Uses local credentials and live credentials when appropriate.
if (file_exists(dirname(__FILE__) . '/local.php')) {
// Local Environment
define('WP_ENV', 'development');
//define('WP_DEBUG', true);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'name');
@barbwiredmedia
barbwiredmedia / gist:3947e6498a37fec93b0b
Created January 6, 2015 19:42
Wordpress echo page template
<?php echo '<!-- ' . basename( get_page_template() ) . ' -->'; ?>
@barbwiredmedia
barbwiredmedia / include.php
Created December 19, 2014 18:07
Wordpress php include template path
<?php include(TEMPLATEPATH . '/your/file/path.php'); ?>