Question regarding home.php

Homepage Community Forums Optimal Theme Support Question regarding home.php

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2008
    walidmrealtor
    Customer

      Hello Wes, I am trying to implement the generate box seen in this theme – http://demo.studiopress.com/generate/

      For home.php they have the following code:

      <code>__________home.php

       

      /** Add Generate Box after header **/

      add_action( ‘genesis_after_header’, ‘generate_box’, 10 );

      function generate_box() {

       

      if ( is_active_sidebar( ‘generate-box’ ) ) {

      echo ‘<div id=”generate-box”><div class=”wrap”>’;

      dynamic_sidebar( ‘generate-box’ );

      echo ‘</div><!– end .wrap –></div><!– end #generate-box –>’;

      }

       

      }</code>

       

      Will this display the generate box in the correct location under the slider in the manner it is currently coded?

      #2015
      Wes
      Moderator

        It may, have you tried it yet?

        The key part is the (genesis_after_header) You might have to change the priority to a different number so it shows up in the order you want.

        #2018
        walidmrealtor
        Customer

          No, I figured I’d check with the expert first 🙂 That was actually the portion that slowed me down and prompted me to contact you.

          I’m not very familiar with this particular coding though I do have limited understanding…

          #2022
          walidmrealtor
          Customer

            Ok, I have the following code loaded first in home.php

             

            <?php

             

             

            /** Add Generate Box after header **/

            add_action( ‘genesis_after_header’, ‘generate_box’ );

            function generate_box() {

             

            if ( is_active_sidebar( ‘generate-box’ ) ) {

            echo ‘<div id=”generate-box”><div class=”wrap”>’;

            dynamic_sidebar( ‘generate-box’ );

            echo ‘</div><!– end .wrap –></div><!– end #generate-box –>’;

            }

             

            }

             

            add_action( ‘genesis_meta’, ‘optimal_home_genesis_meta’ );

            /**

            * Add widget support for homepage. If no

             

             

            I’ve added all of the CSS except for the responsive. Nothing. None of the CSS is showing up. Is this code affecting that?

            #2023
            walidmrealtor
            Customer

              Ok. I can get it to show up; however, it shows up in the spot where the slider is.

               

              Can you help me get it to position directly under the slider?

              #2024
              walidmrealtor
              Customer

                Oops, here’s the images of the issue –

                 

                I’d like it to butt up against the bottom of the slider (or even move to the bottom of the slider)…

                http://i.imgur.com/JctXa.jpg

                 

                http://i.imgur.com/kSraH.jpg

                #2025
                Wes
                Moderator

                  Try adding a priority like the example above – add_action( ‘genesis_after_header’, ‘generate_box’, 10 ); and change the number until it shows in the right place.

                  #2033
                  walidmrealtor
                  Customer

                    I did, that doesn’t work.

                    I think something’s going on with the conditional tags that’s preventing it from showing in the right place.

                    #2037
                    Wes
                    Moderator

                      If you change the number it will change positions, but you have to keep in mind that you have other sections that are set to show “after the header”.  The slider and welcome area are grouped together, so you will either have to split them, or simply add the widget code in between them in the same way that they are created.

                      This process is more difficult than it should be, you could just copy and rename the slider or the welcome widget code in the home.php and it will work.  You don’t have to use the code you pasted above, just simply create a new widget like you’ve done before in the other areas of your site.

                      Also, when posting code here in the forums click the html tab first, add your code, then highlight your code and click the “code” tab in the editor…..otherwise your code won’t show up right and each comma and apostrophe gets thrown off.  I had to replace each one to get it to show up right when testing your code.

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.