Skip to content

Instantly share code, notes, and snippets.

@eemagine
eemagine / header.php
Created September 20, 2012 11:42
WP Twenty Eleven navigation
<divid="menu"class="menu-center">
<?php wp_nav_menu( array('theme_location'=>'main'));?>
</div>
@eemagine
eemagine / style.css
Created September 20, 2012 11:39 — forked from luetkemj/style.css
WP-CSS: Wordpress classes
/* =============================================================================
WordPress WYSIWYG Editor Styles
========================================================================== */
.entry-content img {
margin: 0 0 1.5em 0;
max-width: 100%;
height: auto;
}
.alignleft, img.alignleft {
@eemagine
eemagine / wp-query-ref.php
Created September 20, 2012 11:38 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@eemagine
eemagine / wordpress-jquery-file.js
Created April 13, 2012 11:59
Black&White avatars in wordpress
$(window).load(function(){
console.log($('img#avatar'));
// displaying avatars in carousel
$(".carousel-holder").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev",
visible: 8
});
$('img#avatar').each(function(){
var imgObj = $(this)[0];
@eemagine
eemagine / single.php
Created April 13, 2012 11:53
Wordpress nested loops
<?php
$temp = $post; // stash previous loop
// begin nested loop
$args2 = array( 'post_type' => 'brand', 'p' => $partner_id);
$loop2 = new WP_Query( $args2 );
while ( $loop2->have_posts() ) : $loop2->the_post();
?>
<!-- do stuff -->
<?php
@eemagine
eemagine / wp-user-redirect.php
Created April 13, 2012 11:51
wordpress redirect logged user to homepage
/* Add to functions.php */
add_filter("login_redirect", "subscriber_login_redirect", 10, 3);
function subscriber_login_redirect($redirect_to, $request, $user){
if(is_array($user->roles)){
if(in_array('administrator', $user->roles)) return home_url('/wp-admin/');
}
return home_url();
}