Forum Replies Created
-
AuthorPosts
-
December 4, 2019 at 9:49 pm in reply to: Is this hook removed? Replacement? genesis_before_sidebar_widget_area #495260kennypressParticipant
Hi, don't want to totally hijack this thread. Still mostly want to find out if there are any updated v.3 hooks guides or resources, as with the OP.
But we used custom themes on all of our sites that are based on a stripped-down base child theme that just has some common items we use on all sites. These themes are HTML5 enabled, however. The code we are using produces an aside with the widget code inside.
December 3, 2019 at 8:33 pm in reply to: Is this hook removed? Replacement? genesis_before_sidebar_widget_area #495211kennypressParticipantHi, I have the same problem and question. Site completely broke when I updated to Genesis 3.x due to deprecated hooks.
- Are there any resources yet to see approved/current v.3 hooks? All of the visual hook guides I find do still show the deprecated hook in question, even newer posts.
In case it's helpful, I was adding a custom sidebar to the header.
remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); add_action( 'genesis_before_content', 'get_page_header_sidebar' ); function get_page_header_sidebar() { genesis_before_sidebar_widget_area(); dynamic_sidebar( 'page-header-widget' ); genesis_after_sidebar_widget_area(); }
- Are the 'before' & 'after' hooks just not needed anymore and should be deleted, or replaced with something appropriate?
kennypressParticipantThanks for the replies!
I think the only thing I'm trying to take from Bootstrap is the 12-column, fluid grid. I don't need any of the other user-interface/styling things. Just want a quick layout option for going from a design based on this grid to working site.
And I know for it to work there has to be proper markup, including some sort of 'row' container around columns. For now, the site I'm working on is mostly single-column, so leaving as-is. But for a couple CPTs that I have to create templates for, I'm including a 'row' type container, and adding some Bootstrappy column classes. Does make it quick to get proper fluid column widths with proper set gutters.
Guess I was wondering if anyone had gone a little farther with tweaking and/or customizing the Genesis markup a bit to allow for a similar fluid grid to work.
And we've kind of committed to Genesis (at least for now), so don't want to abandon now and try to find another framework.
I guess as designers, we needed something to base designs on that wouldn't require crazy custom sizing & workarounds for each new site. So we settled in to using a 12-column grid (based on BS). This did give at least some 'framework' to design, and made implementing much simpler. And we do everything fluid-responsive, setting break points where the content deems necessary for good layout (not just some arbitrary 'typical' screen sizes). So the sites should look really good at just about any size.
kennypressParticipantHmm, this is harder to figure out than I would imagine. Almost every reference I find just describes how to 'unregister' the header-right widget area. I've already done this, and it's no longer in the back-end. But how can I get the markup to not be written to the front-end of the site as it's empty/unused?
I also noticed something similar when I added a new custom sidebar to my pages. When there are no widgets displaying, the empty <aside> tag is still output in the markup.
- How can I force sidebars to not be written if there are no widgets in them???
Didn't think this would be that difficult or uncommon.
Thanks!
kennypressParticipantWow, this is great David, thanks! It would definitely be handy to know PHP, but I've got my hands full with staying on top of design and advanced front-end coding.
This should do the trick. We'd still need to include a secondary declaration on styles for the top-level 'landing page' if we were displaying that as well (e.g., '.page-id-2' as well as '.top-parent-2'). But at least it would be possible.
This should work for most standard situations. Hopefully it can help someone else too if they order a site/pages into 'sections'. It's important to note that it follows page order not menu order, but we always keep those in-sync so our breadcrumbs and side split sub-nav links work properly as well.
The only thing that might have to be figured out on occasion is if we need to add a custom post type or something else into a 'section' along with pages, as I'm assuming those would not pick up the hierarchy of the pages. But we'll cross that bridge when it comes up.
Thanks again. Much appreciated.
kennypressParticipantThanks for the tips David. This was more what I was looking for. I would just add the code to our functions file for the base child theme we're creating so it could be there for all sites we create. It does no harm to have the additional classes.
I'll look over your examples and try to piece it together. Unfortunately, PHP is not my strength (which is why I wanted to see if something already existed). But we can have a developer help if we need.
I found this which is pretty close, just uses the parent slug. But it does 'trickle down' to all subpages. Not sure of pros/cons to using the slug instead of a page or menu ID, though.
But I'm sure someone who knows PHP well could put everything together pretty quickly.
Thanks.
kennypressParticipantThanks for the reply. Sorry, I had seen that 'parent-page-##' class, but it only works for one level deep menus. Any sub-subpages would pick up their direct parent's ID, not the top-level.
So I was just hoping that with the popularity of Genesis and all the snippets that exist, someone may have gone one-step beyond that so it would list the top-most menu parent ID.
It would need to be automated so that any pages/menus added by the client, regardless of the depth, would still pick up any 'parent' styling by default. The client would never know to add custom classes or anything special (and shouldn't need to).
And it's not that uncommon of a design standard to give certain 'sections' a bit of a more unique style. Not drastic changes, but maybe a highlight color is different, background image is different, etc. Like having a boys & girls section to your store site, they don't need to (and shouldn't have to) be identical in styling. We used to work primarily in Joomla, and something like this wasn't too tough to pull off. Just new to Genesis and trying to see if it already exists so we can use any existing standards where possible.
Thanks again!
kennypressParticipantThanks for the help. Looks like the developer who helped first create this base child theme didn't add the line:
include_once( get_template_directory() . '/lib/init.php' );
Once I added that, things started working a bit better. Is that absolutely required and the 'best/most efficient' way to go about it??
And the reason I was doing it manually vs. using the plugin right now are:
A) thought it would be good to start learning the 'proper' way to do things so I know the syntax a bit;
B) worried about the plugin becoming outdated/incompatible on an update;
C) wasn't certain the plugin could do everything that may be needed for changing/overriding, which may result in some changes being in plugin and some in functions.php, which just may get confusing to see what's really going on.Let me know if any of my concerns about the plugin are unwarranted.
Thanks!
kennypressParticipantThanks again for the insight. I know there will be a learning curve, especially not being fluent in PHP.
I was hoping that the numerous tutorials and code snippets available would be helpful, but in my brief time I've found it might be pretty challenging to sift through what is 'current - 2.x' vs what is outdated info (even possibly on MyStudioPress) : (
I am very experienced with CSS/HTML, though, and know how I 'could' have approached it as a workaround. But I want to start off with the cleanest code so workarounds will be fewer and CSS will be more efficient.
But in my searching, I did find what 'appears' to be the solution (had to figure out how to modify for 2.0). In case it helps anyone, I added this:
add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'site-inner', 'footer' ) );
So now I have the consistent .wrap DIVs which will make full-width, liquid layouts a bit cleaner. But I do worry about how 'stable' this is if structural changes happen like this again...
kennypressParticipantThanks for the reply Dave! I appreciate it.
Actually, the .wrap DIV was INSIDE .site-inner, just like the other main content areas (header, nav, footer). So it was much more consistent and you could apply a general style (like max-width) to these generic .wrap DIVs, but leave their parents alone.
So if I was going to do something consistent, I would want to style the 'content-sidebar-wrap' DIV, which doesn't appear to have any styling by default. But not sure that will ALWAYS be there in all different page templates, layouts, etc.
And I did copy the Genesis Sample theme CSS as a starting point. But I'm stripping a lot of unnecessary stuff out to try to make a skeleton 'Bootstrap-y' theme that we can use as a starting point. I will need to make it liquid responsive, so the structure is really important to make this easy and flexible.
So in a typical theme I could add the .wrap DIV back in, or add another class of .wrap to the .content-sidebar-wrap DIV, in about 2 minutes. And then have a much more consistent and simplified structure to begin with.
A) How could I add these in Genesis properly?
I'm new to hooks/filters/actions, so a little direction may help (wish I knew PHP better).B) Is there a danger in doing this for our 'master' child theme?
I want to be future-proof as much as possible, but am already nervous that this element was dropped (we only found it as we had a javascript action that was looking for something in .wrap and it got broken - not good).Thanks again!
-
AuthorPosts