Adding 3-column text to home page

Community Forums Forums Design Tips and Tricks Adding 3-column text to home page

This topic is: not resolved

This topic contains 19 replies, has 3 voices, and was last updated by  jtintner 10 months ago.

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #46483

    Patrick
    Participant
    Post count: 5

    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.com
    #46519

    braddalton
    Participant
    Post count: 7454

    The 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.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46546

    Patrick
    Participant
    Post count: 5

    Great, 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?

    #46547

    braddalton
    Participant
    Post count: 7454

    Did 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.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46548

    Patrick
    Participant
    Post count: 5

    Yes, I checked to make sure my child theme had it built in and it did.

    #46551

    braddalton
    Participant
    Post count: 7454

    Yes 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.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46558

    Patrick
    Participant
    Post count: 5

    Got it! Exactly what I was hoping for. Your the man – thanks a ton for your help!

    #46562

    braddalton
    Participant
    Post count: 7454

    No worries.

    You can easily style your widget using an existing class from your footer or other CSS.

    Link to pro tip in the code.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46632

    jtintner
    Participant
    Post count: 16

    I 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?

    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    #46636

    braddalton
    Participant
    Post count: 7454

    The 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.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46641

    braddalton
    Participant
    Post count: 7454

    You’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.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46643

    jtintner
    Participant
    Post count: 16

    sorry 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

    • This reply was modified 10 months ago by  jtintner.
    • This reply was modified 10 months ago by  jtintner.
    #46647

    jtintner
    Participant
    Post count: 16

    @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

    #46651

    braddalton
    Participant
    Post count: 7454

    Code looks fine on Github so please try again


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #46673

    jtintner
    Participant
    Post count: 16

    I can’t seem to get this code to work so I’m not really sure where the problem is :( DOHH!!!

Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic.