Forum Replies Created
-
AuthorPosts
-
lucaslemMember
You're almost there!
If you specify
genesis_before_header
you're actually putting it inside the header element. What you want to do it place before that so you need to specifygenesis_before
.The code looks like this:
remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_before', 'genesis_do_subnav', 1 );
One more thing, you will need to tweak the CSS for the header (class= .site-header) as it is set to fixed and your secondary menu is going to be hidden beneath it.
lucaslemMemberBrad, thank-you for the cleaner code tip! Still learning π
Also thanks for the link to your post. This is really great for learning as even though I have been using ACF (which is by all accounts a solid plugin), I always like to know how things are actually built and how they work. May code a few of these boxes by hand following your method for practice π
Are you at all involved with WP Mentor? Do you ever do code reviews? Doesn't hurt to ask, right? π
lucaslemMemberThanks!
Actually, it was a bit different because I wanted some of the code to go within the header and some of it after (in entry content)... but the closing header tag was missing because I had added this in my functions file (I wanted to get rid of the post info):
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_post_info' ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 15 );
As soon as I got rid of the first and third line, I was good: post info gone, markup still there.
lucaslemMemberNothing like posting to forum to finally solve the problem on your own!
So my bad: I had code elsewhere in my functions file to remove the header entry meta for that cpt, and I had also removed the header markup.lucaslemMemberFYI the HTML debugging is telling me that there is no closing tag for <header class="entry-header">. I'm not messing with any of the theme's html, so I'm guessing there must be some additional code I need to include in the add_action or in my function.
May 29, 2014 at 9:20 am in reply to: Best practice: put code in functions.php or template file? #107301lucaslemMemberThanks Brad, will definitely check out stackxchange for specific code issues.
I was asking mainly because I read somewhere that it's not a good idea to have a very large functions file, though it was never made clear why nor was specified how many lines actually make the file "large". I find it easier to put my code in functions (even for structural HTML changes) just because I can easily apply that code to (or remove it from) other sections of the site with a quick conditional change.
I will create templates if they make life easier for clients.
Good to know the answer is indeed "it depends" and not some hard and fast rule. Cheers.
lucaslemMemberOk, fixed. In case this helps anyone else I will share that I overlooked the priorities used in this theme for the menu positioning:
//* Reposition the header
remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
remove_action( 'genesis_header', 'genesis_do_header' );
remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
add_action( 'genesis_before', 'genesis_header_markup_open', 5 );
add_action( 'genesis_before', 'genesis_do_header', 10 );
add_action( 'genesis_before', 'genesis_header_markup_close', 15 );I just needed to add a higher priority to the secondary navigation menu to make it appear above the header.
lucaslemMemberThanks you guys!
Dave, yes indeed we have... and many of our exchanges were for this very site. Many many thanks πlucaslemMemberI've gone ahead and also removed all CSS which affects positioning. No dice; the html is still still the issue here.
Theremove_action
works just fine. It's theadd_action
which does not seem to be doing anything. Would love any other ideas on this.lucaslemMemberHi Lauren,
The fixed position was my first thought as well, but the HTML is not displaying in the order I would expect from the code I used to reposition the menus.
Here's what comes out:
<header class="site-header" role="banner" itemscope="itemscope" itemtype="http://schema.org/WPHeader"> <div class="wrap"> <div class="title-area">title stuff here</div> <aside class="widget-area header-widget-area"> <section id="nav_menu-2" class="widget widget_nav_menu"> <div class="widget-wrap"> <nav class="nav-header" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"> <ul id="menu-navigation" class="menu genesis-nav-menu"> Main nav items all listes here </ul> </nav> </div> </section> </aside> </div> </header> <div class="site-container"> <nav class="nav-secondary" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"> <div class="wrap"> <ul id="menu-toolbar" class="menu genesis-nav-menu menu-secondary"> Secondary nav items listed in here </ul> </div> </nav> <div class="site-inner"> ETC...
As you can see the secondary nav does not get bumped up above the header as I would expect. I downloaded a fresh copy of the theme with demo content to rule out any other customizations errors I may have made, but I get the same result.
lucaslemMemberSridhar you're awesome! This is just what I needed. Combined with custom taxonomy queries in the shortcode, I managed to make the sitemap even better than I had hoped π
lucaslemMemberGlad I could help π
lucaslemMemberSridhar,
Thank-you for the snippet. It does work in that my custom posts now appear in the general posts lists, but I suppose I should have been more specific: I would like to display the CPT's in their own list, separate from the blog posts. In other words:
What I currently have:
Custom Post Types:
-- nothingBlog posts:
-- blog post one
-- custom post type one
-- blog post two
-- custom post type two
-- and so onWhat I'm trying to achieve:
Custom Post Types:
-- custom post type one
-- custom post type two
-- and so onBlog Posts:
-- blog post one
-- blog post two
-- and so onThanks for any help π
lucaslemMemberHave you tried:
background-color: transparent;
rather than "none" ?
December 11, 2013 at 11:19 am in reply to: Sass / Scss Version of the Genesis Sample starter child theme #78342lucaslemMemberMore of a SASS guy than LESS, but... potato, potatto.
Also, while I may have only *mentioned* this today, I have searched the forums for many months for hints that this may be in the works... should be more vocal I guess π
December 11, 2013 at 7:54 am in reply to: Sass / Scss Version of the Genesis Sample starter child theme #78313lucaslemMember+1 for Sass on genesis starter theme!
Great work FrΓ©dΓ©ric πIn fact you could put *this* up on github, no?
December 9, 2013 at 10:00 pm in reply to: Make specific posts (CPT) always display at the top regardless of set order? #77958lucaslemMemberIf this helps anyone else, I actually found a plugin which allows me to de *exactly* what I was after with minimal fuss: Post Types Order.
December 9, 2013 at 9:19 pm in reply to: Make specific posts (CPT) always display at the top regardless of set order? #77953lucaslemMemberWorked a treat thanks. Only issue now is that the posts that show up in widget are also showing up down in the list. Anyway to allow the to only show up in the widget area?
December 9, 2013 at 8:04 pm in reply to: Make specific posts (CPT) always display at the top regardless of set order? #77941lucaslemMemberAh Brad I think I understand what you meant... the "page" thing threw me. Ok I know how to register widget areas so that should be fine. I'll set this to resolved once I get this coded and confirm that I got it working. Thanks
December 9, 2013 at 7:52 pm in reply to: Make specific posts (CPT) always display at the top regardless of set order? #77937lucaslemMemberHmmm, I'm not sure I was clear (or I'm misunderstanding your reply). I wish I could link, but I'm developing locally so I will try to be more explicit.
I'm not trying to add pages to anything. Imagine the blog page where you have all the posts titles listed (with excerpts) in reverse chrono order, but you want one of those to always stick to the top of the list regardless of the time it was posted.
That's essentially what I'm trying to achieve except that it's not the blog archive but a "workshop" archive.
-
AuthorPosts