• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Genesis two column layout with ACF

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis two column layout with ACF

This topic is: not resolved

Tagged: ACF, column classes

  • This topic has 5 replies, 2 voices, and was last updated 8 years, 3 months ago by sim_bas.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • August 30, 2017 at 7:45 am #210919
    sim_bas
    Member

    Hello to everybody, I'm very new on Genesis Framework, I started developing a child theme but I've some troubles on the layout of a post page.

    I need to divide my page into two columns of 50% width, the first one (on the left) should contain some custom fields generated with the plugin Advanced Custom Field, the second one (on the right) should contain the entry_content of the post.
    I can get the elements I need in the page but the problem is that the first and the second column doesn't align and the first column remains below the first.
    I tried many solutions but I can't find the right way…

    Here is my actual result Genesis + ACF in two columns

    Here is the php code:

    <?php
    add_filter( 'body_class', 'sp_body_class' );
    function sp_body_class( $classes ) {
    
       $classes[] = 'casatibuonsante-content';
       return $classes;
    }
    
    add_theme_support( 'genesis-structural-wraps', array('header','nav','subnav', 'inner', 'site-inner','footer-widgets','footer') );
    
    // full width content
    add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
    
    //ACF Fields
    add_action( 'genesis_loop', 'info_progetto');
      function info_progetto() {
        if(have_posts()) : while(have_posts()) : the_post(); ?>
          <div class="cb-info-progetto">
            <h1><?php echo get_field('titolo'); ?></h1>
              <h2><?php echo get_field('data'); ?><br></h2>
              <h3><?php echo get_field('info'); ?><br></h3>
          </div>  <?php endwhile; endif; }
    
    // Entry content
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 12 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    
    genesis();

    And here is the css:

    .casatibuonsante-content .site-inner {
    	background-color: yellow;
    	padding: 0;
    	position: relative;
    	height: auto;
    }
    
     .cb-info-progetto {
    	width: 45%;
    	max-width: 45%;
    	background-color: green;
    	position: relative;
    }
    
    .casatibuonsante-content .entry {
    	background: red;
    	width: 50%;
    	position: relative;
    	left: 50%;
    }
    

    Thanks a lot to anyone can help!
    Simone

    http://localhost
    September 1, 2017 at 10:35 am #211023
    Brad Dalton
    Participant

    Use column classes https://gist.github.com/studiopress/5700003#file-two-columns-html


    Tutorials for StudioPress Themes.

    September 1, 2017 at 11:02 am #211026
    sim_bas
    Member

    Hello Brad, thank you for your answer. I'm looking for a soluction in the way you suggested, the problem now is that the columns not floatings but stay one below another…

    Here is the code I'm using now:

    /* ACF */
    add_action( 'genesis_before_entry_content', '\contenuto_sx', 1 );
    
      function contenuto_sx() {
        echo '<div class="one-third" style="background:pink;">';
        echo get_field('titolo');
        echo get_field('data');
        echo get_field('info');
        echo '</div>';
    
      }
    
    /* entry-content */
    add_filter ('genesis_attr_entry-content', '\contenuto_dx');
      function contenuto_dx ( array $attributes ) {
        $attributes['class'] .= ' one-half';
    
        return $attributes;
      }
    
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 12 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

    And here is the result I get…
    acf

    September 1, 2017 at 11:34 am #211035
    sim_bas
    Member

    Hello Brad, thank you for your answer, I'm looking for a solution in the way you suggested, the problem is that columns does not floatings and remains one below the another.
    Here is the code of the solution that I'm trying now:

    // full-width layout
    add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' ); */
    
    /* ACF  */
    add_action( 'genesis_before_entry_content', '\contenuto_sx', 1 );
    
      function contenuto_sx() {
        echo '<div class="one-third" style="background:pink;">';
        echo get_field('titolo');
        echo get_field('data');
        echo get_field('info');
        echo '</div>';
      }
    
    /* entry-content */ 
    add_filter ('genesis_attr_entry-content', '\contenuto_dx');
      function contenuto_dx ( array $attributes ) {
        $attributes['class'] .= ' one-half';
        
        return $attributes;
      }
    
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 12 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

    And here is a screenshot of the result:
    acf genesis

    September 1, 2017 at 9:29 pm #211043
    Brad Dalton
    Participant

    The 1st column in the row must use one-third first as indicated in the link i posted.

    Otherwise, you'll need a custom solution coded for your specific needs.


    Tutorials for StudioPress Themes.

    September 5, 2017 at 10:17 am #211130
    sim_bas
    Member

    I tried to insert the "first" class on the first column but it doesn't work (it justs eliminate the left-margin of the pink div).

    If this could help someone, I resolved the issue inserting the div with custom fields in entry-content (instead of before entry-content) adding the classes for the first column of the grid (in my case "one-half" and "first"). Then I styled instead of the whole entry content just only ".entry-content p" giving it the same values of one-half (second column of the grid) should have like this:

    .myclass .entry-content p { 
    	float: right;
    	width: 48.717948717948715%; //same value of one half
    	margin-left: 2%;
    }

    Then I custom style ".myclass .entry-content p" for devices with media queries
    It is a little bit tricky but it works…

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble