Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding 3-column text to home page
Tagged: footer, generate theme
- This topic has 19 replies, 3 voices, and was last updated 11 years, 2 months ago by jtintner.
-
AuthorPosts
-
June 17, 2013 at 9:58 pm #46483PatrickMember
Hi, I'm trying to add 3 columns of text to my home page under the generate box, but above my blog articles (in the same style as the footer, but without the background). Any suggestions?
Thank you!
http://officeliberator.comJune 18, 2013 at 7:50 am #46519Brad DaltonParticipantThe easiest way to do this is to add a new widget and use content columns in a text widget.
Please copy and paste the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.
You could also hook in 3 widgets however that would require a fair amount of custom coding knowledge.
You will need to add CSS code for padding etc.
June 18, 2013 at 10:17 am #46546PatrickMemberGreat, looks like this got me 50% there. I added the php and it did add the Home Columns widget, but when I add 3-columned text in a text widget, from the example you showed, nothing appears on my home, as you can see (I left the widget active so you can see). I am very grateful for your help thus far - any further suggestions?
June 18, 2013 at 10:27 am #46547Brad DaltonParticipantDid you also add the CSS to your child themes style.css file? http://my.studiopress.com/tutorials/content-column-classes/
The HTML alone will not work without the CSS.
June 18, 2013 at 10:28 am #46548PatrickMemberYes, I checked to make sure my child theme had it built in and it did.
June 18, 2013 at 10:38 am #46551Brad DaltonParticipantYes sorry. My bad. I changed the code in Github after posting it here for another tutorial.
I thought you already had it copied.
Try the PHP again please.
June 18, 2013 at 10:43 am #46558PatrickMemberGot it! Exactly what I was hoping for. Your the man - thanks a ton for your help!
June 18, 2013 at 10:51 am #46562Brad DaltonParticipantNo worries.
You can easily style your widget using an existing class from your footer or other CSS.
Link to pro tip in the code.
June 18, 2013 at 4:15 pm #46632jtintnerMemberI get an error when I add this code above to my functions.php file in my child theme
Fatal error: Call to undefined function genesis_register_sidebar() in C:\xampp\htdocs\routinechaos\wp-content\themes\blueeel\functions.php on line 41
here is my functions file
`
<?php
/**
* Functions
*
* @package BlueEel
* @author Josh Tintner
* @copyright Copyright (c) 2031, Josh Tintner
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*//**
* Theme Setup
*
* This setup function attaches all of the site-wide functions
* to the correct actions and filters. All the functions themselves
* are defined below this setup function.
*
*/add_action('genesis_setup','child_theme_setup', 15);
function child_theme_setup() {// Add Nav to Header
add_action('genesis_before_header', 'be_nav_menus','genesis_header' ,'genesis_after_header' ,'be_nav_menues_seconday' );}
/**
* Add Nav Menus to Header
*
*/function be_nav_menus() {
echo '';
wp_nav_menu( array( 'menu' => 'Primary' ) );
echo '';
}
genesis_register_sidebar( array(
'id' => 'custom-widget',
'name' => __( 'Home Columns', 'wpsites' ),
'description' => __( 'Adds Home Page Widget For 3 Columns', 'wpsites' ),
) );
/**
* @author Brad Dalton - WP Sites
* @learn more http://wp.me/p1lTu0-a0y
*/
add_action( 'genesis_before_content_sidebar_wrap', 'wpsites_home_widget', 5 );
function wpsites_home_widget() {
if ( is_home() && is_active_sidebar( 'custom-widget' ) ) {
echo '';
dynamic_sidebar( 'custom-widget' );
echo '';}
}
`
But I have no errors in the PHP file, any thoughts here?June 18, 2013 at 4:24 pm #46636Brad DaltonParticipantThe code is tested and works. Whats on line 41?
Can you please paste the code on Github Gists or Pastebin and link to it from here please.
June 18, 2013 at 4:41 pm #46641Brad DaltonParticipantYou've missed some of the code:
//This works echo '<div class="custom-widget">'; dynamic_sidebar( 'custom-widget' ); echo '</div><!-- end .custom-widget -->'; }} //This doesn't echo ''; dynamic_sidebar( 'custom-widget' ); echo '<!-- end .custom-widget -->'; }}
Please copy the code from the view raw link and paste it at the end of your child themes functions.php file.
June 18, 2013 at 4:43 pm #46643jtintnerMembersorry don't know how to copy and paste the block in from github so here is the direct link to the file
https://github.com/jtintner/routinechaos/blob/master/functions.php
line 41 appears to be where your code starts.
normally I'm pretty good with php massaging but actually building PHP from scratch is not my strong suite, hence why I'm taking this challenge on 🙂
P.S since I'm building this on local host its going to be really hard to provide a URL but if it works best to move this to a URL I can do so and share links if your willing to help me along with some of this
June 18, 2013 at 4:50 pm #46647jtintnerMember@branddalton
Check the github link I sent, for some reason when I copied and pasted it into the response window it removed some of the PHP so take a look at that instead of what I posted in the comment I will go ahead and delete it
June 18, 2013 at 5:46 pm #46651Brad DaltonParticipantJune 18, 2013 at 8:23 pm #46673jtintnerMemberI can't seem to get this code to work so I'm not really sure where the problem is 🙁 DOHH!!!
June 19, 2013 at 5:33 am #46707jtintnerMemberI've been fumbling with this for the last several hours this morning, I'm starting to get frustrated with why I can't register a new sidebar as you have shown here.
I have been watching numerous videos and have read quite a few blog posts in the last 2 hours with little success. While I was able to play around a bit with adding some stuff to specific areas on the page I want to do some more of this dynamic stuff you are talking about.
It seems that when I add any of the
genesis_register_sidebar anything the site bombs out. Here is what I have added to my functions.php file
https://github.com/jtintner/routinechaos/blob/master/functions.php
I've been trying to debug this for hours with little success.
For some reason I cant even register the sidebar at all. I can do other simple minded tasks like trying to add in some echo text and point it to above or below content no problem.
Am I missing something on how to register a new sidebar? Is there an added step I'm missing?
Sorry for all the random flusterd posts, I will try to keep those to a minimum
P.S I actually created a live site, (which right now wont work unless I remove the registering of the sidebar in my github code) Which I have done temporarily just so you can see the site.
June 19, 2013 at 5:45 am #46710Brad DaltonParticipantThe link above does not include the entire code i pasted for you to use.
It also does not include all your functions.php file code.
All code i paste on these forums works because i test it. I have tested the code 3 times now on 3 separate themes.
June 19, 2013 at 6:48 am #46719jtintnerMemberYou are 100% correct in that it does work, I downloaded the sample Genesis theme and stuck your code on there and it worked. For some reason it didn't work in my functions.php file that I created, I'm not really sure why but it didn't.
Something on the top of my functions file was making it not function properly, not to sure why since as I said PHP has never really been my strong suite. In any case, I never doubted you more or less trying to trouble shoot with some help. I will just use the sample theme and modify this functions.php file instead of creating my own, but this did work now
June 19, 2013 at 6:55 am #46722Brad DaltonParticipantGood idea Josh.
The Genesis 2.0 sample theme supports HTML 5 and i actually use it on my own site. You will need Genesis 2.0 to run this theme unless you use the 1.92 version.
I think you have a problem with the PHP in your old themes functions file.
June 19, 2013 at 7:02 am #46724jtintnerMemberBrad
I was actually running the 1.92 version of the Genesis framework but now I think I have everything figured out. I was about 2 seconds away from even going down this endeavor 🙂 but thanks for all your help honestly!
one last question what does the '5' do?
add_action( 'genesis_before_content_sidebar_wrap', 'wpsites_home_widget', 5 );
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.