Viewing 6 replies - 1 through 6 (of 6 total)
  • Unfortunately, it’s on the complicated side…

    To change the column count you’d have to add code in the theme options for you extra columns (requires a separate field that gets filtered/saved/loaded for each image, title, text and read more link).

    Then you’d need to add the code to display it on the frontend, and also make the proper CSS changes to fit the new layout.

    This will take several man-hours to complete.

    Thread Starter hpwtexas

    (@hpwtexas)

    Raspberries.
    Lol maybe I’ll just go with plan b — Been looking for a while to find a way to add my own html (not just shortcode) to the presentation page, and I dont mind editing php files to make the boss happy — I just cant seem to track down the “root” file for the presentation page that I want to edit. Thoughts?

    Thread Starter hpwtexas

    (@hpwtexas)

    Alright! I got it worked out. Not quite the way I wanted — but by god, it works. So, if anyone’s interested:
    Looks like /admin/settings.php controls most of the ‘Mantra Settings’ panel. Open it up and ctrl+f for ‘frontcolumns’ .. if say, I want 9 total columns; change this line
    $items = array ("0" ,"1", "2" , "3" , "4");
    to:
    $items = array ("0" ,"1", "2" , "3" , "4", "5" , "6" , "7" , "8", "9");
    And duplicate this block of code for each column being added (and change every ‘4’ to a ‘5’, etc.):

    <div class="slidebox">
    <h4 class="slidetitle" >  <?php _e("4th Column","mantra");?> </h4>
    (...)
    </div>

    Not too bad so far. Save, then open /includes/theme-frontpage.php and ctrl+f for ‘column3’ .. this was the tricky part for me.. grab this block of code (which is for column 3):

    <?php  if($mantra_nrcolumns != '2') { ?>
    	<div id="column3">
    		<a  href="<?php echo esc_url($mantra_columnlink3) ?>">	<div class="column-image" ><img  src="<?php echo esc_url($mantra_columnimg3) ?>" id="columnImage3" alt="" /> </div> <h3><?php echo $mantra_columntitle3 ?></h3> </a><div class="column-text"><?php echo do_shortcode ( $mantra_columntext3 );?></div>
    	<?php if($mantra_columnreadmore) {?>	<div class="columnmore"> <a href="<?php echo esc_url($mantra_columnlink3) ?>"><?php echo esc_attr($mantra_columnreadmore) ?> »</a> </div><?php } ?>
    	</div>

    Copy and paste it after the block of code for column 4, for each additional column. Then change out the numbers beginning with the fourth column (which reads nrcolumns == '4' in the first line) so that the first line now shows the previous column number:
    <?php if($mantra_nrcolumns != '3') { ?>
    and the rest of the block reflects the current column number. Then the last column is changed so that all numbers in this block reflect the last column number, and also change the != in the first line to == . So, the resulting snippet is:

    <?php  if($mantra_nrcolumns != '2') { ?>
    	<div id="column3">
    		<a  href="<?php echo esc_url($mantra_columnlink3) ?>">	<div class="column-image" ><img  src="<?php echo esc_url($mantra_columnimg3) ?>" id="columnImage3" alt="" /> </div> <h3><?php echo $mantra_columntitle3 ?></h3> </a><div class="column-text"><?php echo do_shortcode ( $mantra_columntext3 );?></div>
    	<?php if($mantra_columnreadmore) {?>	<div class="columnmore"> <a href="<?php echo esc_url($mantra_columnlink3) ?>"><?php echo esc_attr($mantra_columnreadmore) ?> »</a> </div><?php } ?>
    	</div>
    
    (...)
    
    <?php  if($mantra_nrcolumns != '7') { ?>
    	<div id="column8">
    		<a  href="<?php echo esc_url($mantra_columnlink8) ?>">	<div class="column-image" ><img  src="<?php echo esc_url($mantra_columnimg8) ?>" id="columnImage8" alt="" /> </div> <h3><?php echo $mantra_columntitle8 ?></h3> </a><div class="column-text"><?php echo do_shortcode ( $mantra_columntext8 ); ?></div>
    	<?php if($mantra_columnreadmore) {?>	<div class="columnmore"> <a href="<?php echo esc_url($mantra_columnlink8) ?>"><?php echo esc_attr($mantra_columnreadmore) ?> »</a> </div><?php } ?>
    	</div>
    
    <?php  if($mantra_nrcolumns == '9') { ?>
    	<div id="column9">
    		<a  href="<?php echo esc_url($mantra_columnlink9) ?>">	<div class="column-image" ><img  src="<?php echo esc_url($mantra_columnimg9) ?>" id="columnImage9" alt="" /> </div> <h3><?php echo $mantra_columntitle9 ?></h3> </a><div class="column-text"><?php echo do_shortcode ( $mantra_columntext9 ); ?></div>
    	<?php if($mantra_columnreadmore) {?>	<div class="columnmore"> <a href="<?php echo esc_url($mantra_columnlink9) ?>"><?php echo esc_attr($mantra_columnreadmore) ?> »</a> </div><?php } ?>
    	</div>

    ..and finally just below the last column there’s this confusing line:
    <?php } } }?>
    ..if say, I now have a total of 9 columns, this line should be changed to have 8 closing curly braces:
    <?php } } } } } } } }?>
    Whew. Didn’t have any issues with layout or css surprisingly .. backend and frontend look pretty good so far. Id love to do this through my child theme somehow, but this works for now.

    That’s one of the craziest edit I’ve seen so far. :))))

    To move this to a child theme, just copy the theme-frontpage.php file to your child theme’s folder, next to the style.css file.
    Then create a functions.php file with the following content:

    <?php
    
    require_once(dirname(__FILE__) . "/theme-frontpage.php"); //Frontpage file
    
    ?>
    Thread Starter hpwtexas

    (@hpwtexas)

    Fantastic! Thanks, works nicely! Now, doing something like this with the admin/settings.php file would be wishful thinking, right?

    Thanks again! this also helps answer another question I’ve been pondering! (Using “subdirectory theme files” with a child-theme)

    Well I’ve created the functions.php as above and placed it in the root directory of my mantra-child theme. I’ve also modified a copy of the theme-FrontPage.php file and put it into a sub-folder of my mantra-child theme folder.
    I then modified a copy of the settings.php file and also placed it into the root directory of my mantra-child theme.
    The theme-FrontPage.php is being called okay as the 5th column appears on my front page but not the settings.php file; so I don’t get the 5th Column option under mantra settings > presentation page.
    How do I get the settings.php file applied?
    By the way hpwtexas, thanks for the great work!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Increase columns on page presentation’ is closed to new replies.