0

I have a Wordpress site that is using the OrganicThemes - Photographer theme. The demo site can be viewed here: http://organicthemes.com/demo/photographer/three-column-portfolio/

After I customized it for a while, I realized that the three-column portfolio is not centered in the 980px .row class. Because this is using Wordpress and PHP, when I inspect it in Chrome, it renders out in HTML, making it harder for me to understand how to fix the problem.

I included a screenshot of the issue I am facing. You can see in the blue box that the third image (aka <div class="one-third masonry-brick">) does not hit the 980px mark of the <div class="row holder-third masonry">, which makes the second image not center correctly, which basically causes the whole thing to be off.

screenshot

You can find the different class information in the style.css and the organic-shortcodes.css, which helps for understanding the .row and .one-third classes, but I think the real problem is in the jquery.custom.js file. I believe the main code in that file that is of concern to the problem is this:

/* Masonry ---------------------*/
    function masonrySetup() {
    $('.holder-third').masonry({
    itemSelector : '.one-third',
    gutterWidth : 0,
    isAnimated: true,
    columnWidth : function( containerWidth ) {
        return containerWidth / 3; }
    }).imagesLoaded(function() {
    $('.holder-third').masonry('reload');
    });

I have tried to figure out how to fix this, but all I could come up with is how to fix the rendered HTML code, which basically would be to make the second image box be at left: 340px; and the third image box should be at left: 680px;, which would then make them centered and even.

But I know that this won't be of any help. Somehow I need to fix the Masonry code in the custom jquery file, and possibly change some of the CSS of the div classes.

I hope someone can help explain the problem better, and possibly shed some light on how to fix this problem! Thanks in advance!

UPDATE: I added some of the CSS style codes in case that is more helpful to find a solution to the problem.

The layout rendered out in Chrome's inspect element is this:

<!-- .container portfolio -->
<div class="container portfolio">
<!-- BEGIN .row -->
<div class="row holder-third masonry" style="position: relative; height: 827px;">
<!-- BEGIN .one-third -->
<div class="one-third masonry-brick" style="position: absolute; left: 0px; top: 0px;">
<!-- BEGIN .one-third -->
<div class="one-third masonry-brick" style="position: absolute; left: 326px; top: 0px;">
<!-- BEGIN .one-third -->
<div class="one-third masonry-brick" style="position: absolute; left: 653px; top: 0px;">

What I don't get is how the positioning is working, when the CSS doesn't say absolute? And I don't see any masonry-brick class anywhere...where is that coming from?

The container portfolio CSS:

.container.portfolio {
    background: none;
    overflow: visible;
    box-shadow: none;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
}
.container {
    background: #FFFFFF;
    max-width: 980px;
    margin: 0px auto 0px;
}

The row CSS:

.row {
    width: 100%;
    max-width: 980px;
    min-width: 727px;
    margin: 0 auto;
}

The one-third CSS:

.container.portfolio .one-third {
    max-width: 312px;
    margin: 0px;
    padding: 0px;
}
* Columns *
.one-third { 
    width:30.66%; 
}
.one-half, .one-third, .two-third, .three-fourth, .one-fourth, .one-fifth { 
    position: relative; 
    margin-right: 4%; 
    float: left; 
}

And then this is the code that seems relevant to the problem from the template-portfolio-three.php file.

<!-- .container portfolio -->
<div class="container portfolio">

<!-- BEGIN .row -->
<div class="row holder-third">

    <?php $wp_query = new WP_Query(array('cat'=>of_get_option('category_portfolio_three'),'posts_per_page'=>of_get_option('postnumber_portfolio_three'),'paged'=>$paged)); ?>
    <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
    <?php global $more; $more = 0; ?>

    <!-- BEGIN .one-third -->
    <div class="one-third">

        <!-- BEGIN .postarea portfolio -->

I see the <div class="one-third"> and wonder if code needs to be added to that area in order to fix my problem?

  • Try to change inside the `jquery.custom.js` the `gutterWidth` (try with whole number and `whole_number+px` in quotes) and/or `columnWidth`, now it is divided by 3 (1/3th from width of the container). – Bud Damyanov May 08 '14 at 06:32
  • @bodi0 Thanks for getting back. When you said to change the `gutterWidth`, try with a whole number and `whole_number+px` in quotes, do you mean like this?? Example: `gutterWidth: '1',` or `gutterWidth: '1px'`? And what do you mean by and/or `columnWidth`? Do you mean I could just go `gutterWidth: 'columnWidth',` and that would solve it? Thanks again for your help! – user3251361 May 08 '14 at 22:43
  • Yep, `gutterWidth: '1px'` and/or `gutterWidth: 1`, for the `columnWidth` I mean not to use function for calculation, as it is now, but fixed (or percentage) value. – Bud Damyanov May 09 '14 at 06:38
  • @bodi0 So, apparently I need to have `columnWidth : function( containerWidth )` because it is a fluid design. On the Masonry website http://desandro.github.io/masonry/docs/options.html under columnWidth, it mentions to use the function if it's a fluid/responsive layout. I also tried changing the `gutterWidth` both ways, but that didn't work. Any other suggestions? – user3251361 May 09 '14 at 20:49
  • @bodi0 I updated the information a bit up above, and listed out the CSS class codes and the relevant code from the template file. Does this combined with the other information before my update help to make more sense of how to fix my problem? – user3251361 May 10 '14 at 02:56

1 Answers1

0

I see something, which may be useful for you - the .one-third class has width:30.66% plus margin-right:4%, which totals to 34.66% occupied space, which is not 1/3th from 100%, either change the margin, or the width of the class, or define your own class with proper width and margins, overwriting the current ones.

Also, keep in mind, that IE 8 has some bugs with max-width/height combined with overflow: auto/scroll (which is used in .row and .container.portfolio class).

Another thing - different browsers round the floating point values differently - some round them up, some round them down to the whole number, as explained here.

Community
  • 1
  • 1
Bud Damyanov
  • 30,171
  • 6
  • 44
  • 52