Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
@rachelbaker
rachelbaker / 1140px-fluid-grid.css
Created August 10, 2012 14:31
Fluid 1140px grid
/*
Page container
*/
.wrapper{
max-width:1128px;
padding:12px;
margin:0 auto;
}
/*
@rachelbaker
rachelbaker / bp-multi-members-loop.php
Created July 24, 2012 15:28
BuddyPress Multisite Filtering Members Loop to only show site members
<?php
// Getting current blog_id
global $wpdb, $current_blog;
$id = $current_blog->blog_id;
// Setting variable for current blog_prefix
$blog_prefix = $wpdb->get_blog_prefix( $id );
// Start the BuddyPress Ajax Members Loop
if ( bp_has_members( bp_ajax_querystring( 'members' ).'&meta_key='.$blog_prefix.'capabilities' ) ) : ?>
@rachelbaker
rachelbaker / font-mixins.less
Created July 23, 2012 13:04
Less Font Stack Mixins
//
// Font Stack Mixins
// Each stack uses the following format: exact font, nearest alternative, platform-wide alternative(s), universal (cross-platform) choice(s), generic.
// Reference URL: http://www.sitepoint.com/eight-definitive-font-stacks/
// --------------------------------------------------
/* Times New Roman-based stack */
.Times { font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif; }
/* Modern Georgia-based serif stack */
@rachelbaker
rachelbaker / bp-default-ajax-loader.php
Created July 21, 2012 02:43
BuddyPress Load Default Ajax Scripts into Custom Theme
<?php
function bp_custom_include_ajax() {
global $bp;
require_once( BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php' );
if ( !is_admin() ) {
// Register buttons for the relevant component templates
// Messages button
if ( bp_is_active( 'messages' ) )
@rachelbaker
rachelbaker / bp-member-roles.php
Created July 18, 2012 20:25
Determine BuddyPress User Role in Members Loop
<?php
// Grab member's userid
$bpuser_id = bp_get_member_user_id();
// Fetch the user's information based on the userid
$user_info = get_userdata($bpuser_id);
// Fetch the user's user level.
// Find more on user levels here: http://codex.wordpress.org/User_Levels
$user_role = $user_info->user_level;
@rachelbaker
rachelbaker / rb_is_user_member_of_blog.php
Created July 13, 2012 13:54
WordPress Multisite Quick Check for User Site Membership
<?php
/**
* rb_is_user_member_of_blog()
*
* Checking current user's site membership with less code in the template files.
* Uses the WPMU function is_user_member_of_blog() which replaces the now deprecated is_blog_user()
*
* @return bool true/false
* @author Rachel Baker
**/
@rachelbaker
rachelbaker / .htaccess-wordpress
Created July 11, 2012 19:40
WordPress Secured htaccess file
# SECURE WP-CONFIG.PHP
<Files wp\-config\.php>
Order Deny,Allow
Deny from all
</Files>
# Block the include-only files.
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
@rachelbaker
rachelbaker / buddypress-theme-keep-active.php
Created July 6, 2012 20:36
Allow BuddyPress theme to be active even if BuddyPress plugin is not active
if ( ! function_exists( 'bp_is_active' ) ) {
return false;
}
@rachelbaker
rachelbaker / jquery-height-detection.js
Created June 28, 2012 21:46
Detect browser window height and set element size to detected height with jQuery
jQuery(window).load(function() {
var bodyHeight = jQuery(window).height();
console.log('browser window height is ' +bodyHeight);
jQuery("section").css("height", bodyHeight); //resizing section element to be same height as window
});
@rachelbaker
rachelbaker / .gitignore_global
Created June 2, 2012 18:44
Gitignore Global
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*._*