March 31, 2013 at 3:57 am #32217
There may be an occasion where I need to stick in several columns on all pages and posts. Would I be able to code the columns using Column Classes and then apply it once to a hook so that the columns show up on all pages and posts? Also, would the columns be responsive if I am using a responsive theme?
March 31, 2013 at 5:00 am #32227
FAT MediaParticipantPost count: 87
The short answer to this is yes. You could definitely do that. Bill Erickson outlines how to create a better, easier grid loop using column classes in this post: http://www.billerickson.net/a-better-and-easier-grid-loop/
What you’re talking about is similar to what he’s doing there. If the content that you wanted to include was static, it would be even easier to include. You’d just need to set up some conditional statements to include your content on the pages/sections that you wanted.
If you need some help figuring it out, let me know and I’ll give you a hand.
March 31, 2013 at 5:06 am #32228
Thanks for the hard question Anita!! hahaha
Maybe this code (forked from Bill Erickson) will help and i will try and modify it at some stage.
I am sure you can paste the HTML for content columns into the Simple hooks field to display content columns in any genesis_hook location so you must be able to add a conditional tag and use the code in a custom function also.
March 31, 2013 at 5:15 am #32229
Thanks guys! This is wonderful. I will give both of these a try today on my demo site. If I have some trouble, I will post back here.
March 31, 2013 at 5:49 am #32235
Here’s the code i wrote which displays 2 content columns using the genesis_before_footer hook which you can change.
You can also add a conditional tag to this custom function.
March 31, 2013 at 6:02 am #32237March 31, 2013 at 6:02 am #32238
So Brad, in the last code you posted, I would just insert that in the functions or add that to the Hook area? Because the columns will have a lot of rows, i.e, 2 columns with 20 lines, 10 each column… I would hate to add that directly to the functions file.
March 31, 2013 at 6:16 am #32239
This code applies to the Genesis content columns code.
You’ll need to add the CSS code for content column classes in your child themes style.css first. This code is a large block of CSS written by Brian Gardner. http://my.studiopress.com/tutorials/content-column-classes/
Then you can add the HTML for the columns in the code. It already has it for 2 columns.
I think what you’ll need is to create a custom widget area and use the HTML for your tables in the text widget.
Or add the HTML between the content column divs where i have placed the sample text.
March 31, 2013 at 6:25 am #32240
I am familiar with the Content Column Classes. I am confused now Brad but all of your writings and options. I just want to create the columns using the content column classes and insert them so that they show up below the content on pages or posts. If I have 20 pages but want the same columns on all 20 pages – use a hook to only have to code the columns once. So which option would serve me better?
March 31, 2013 at 6:56 am #32241
There’s more than one way to do this.
1. You can use the Simple Hooks plugin
2. Create a custom function as above.
3. Create a custom widget.
If you don’t want to add a lot of code to functions.php, add it in a widget. It has to go somewhere.
Adding content columns using custom functions can conflict with other code in certain hook locations which is why i think its best to use a widget for the after post/page location.
March 31, 2013 at 8:07 am #32251
Ok! Now your talking! I love talking these things out with you guys. It really challenges me to LEARN. So, looking at one of the themes that already has the “After Post Ad” or the “After Content Ad” widgets – I could actually start with those and add the columns in one of those.
You must be logged in to reply to this topic.