Forum Replies Created
-
AuthorPosts
-
nickhempseyMember
right right right. Thanks!
One adjustment though.
add_filter( 'genesis_attr_sidebar-primary', 'gd_attributes_sidebar_primary' ); function gd_attributes_sidebar_primary( $attributes ){ $attributes['id'] = 'sidebar'; return $attributes; // Removed ['class'] }
nickhempseyMember@imartins , that code shouldn't set the layout, only return the active layout.
I'm wondering .. are you wrapping this code into a function or just firing it directly in functions.php?
If you have that code directly in functions.php I would suggest making a function that places it in genesis_meta instead.
add_action('genesis_meta', 'mw_conditional_attachments'); function mw_conditional_attachments() { $site_layout = genesis_site_layout(); if ( $site_layout == 'sidebar-content-sidebar' ) { add_action( 'genesis_before_entry', 'mw_add_attachments' ); } else { add_action( 'genesis_entry_footer', 'mw_add_attachments' ); } } function mw_add_attachments(){ $attachments = new Attachments( 'attachments' ); /* pass the instance name */ if ($attachments->exist()) { ?> <ul class="files"> <?php while( $attachments->get() ) : ?> <li> <div class="files-thumbnail"> <?php echo $attachments->image( 'thumbnail' ); ?> </div> <div class="files-details"> <a href="<?php echo $attachments->url(); ?>" target="_blank" class="files-title"> <?php echo $attachments->field( 'title' ); ?> </a> <div class="files-meta"><?php echo $attachments->subtype(); ?> - <?php echo $attachments->filesize(); ?></div> <div class="files-caption"> <?php echo $attachments->field( 'caption' ); ?> </div> </div> </li> <?php endwhile; ?> </ul> <?php } }
let me know if that helps at all.
nickhempseyMemberI did some digging in genesis/lib/structure/layout.php and found the function genesis_site_layout(); It returns the active layout of the page. So I can do this:
$site_layout = genesis_site_layout(); //* Load custom code when content-sidebar is active if('content-sidebar' == $site_layout ){ //* Do something }
nickhempseyMemberThanks Brad,
I'm not looking to create a custom layout, although I will go that route if all else fails.
I just need to know whether or not the current layout is using the primary sidebar or not.
nickhempseyMemberThanks Charles!
nickhempseyMemberThanks Bandj, I appreciate that!
nickhempseyMemberThanks Susan!
I spent a lot of time on the header, I really wanted that feel to carry through every device and the only way to do it was to completely change the layout of the links and logo. 🙂 It took almost two full days just for the header (including pulldowns), but I think it was worth it.
-
AuthorPosts