Support » Themes and Templates » Oh dear – been editing a theme via Firefox & just noticed its broken in Chrome

  • I’m using the Codium theme on this website: I know it’s a big no-no but I’ve been doing some css fiddling all day today and testing via firefox.

    I thought I’d have a play with the theme in IE/Chrome and it looks like I’ve somehow broken the Pages container. If you view any of the pages it causes the sidebar/widget area to shoot off to the far right of the screen (something that doesn’t happen in Firefox). I’m assuming it’s to do with a margin or bit of padding somewhere that’s causing the elements to be too big for the container? I’ve looked through the CSS for the past 2 hours and I’m totally stumped. Can anyone help at all?

Viewing 2 replies - 1 through 2 (of 2 total)
  • ah well, with the help of a friend I worked out that it’s because I disabled the comments section in page.php:

    <!--<?php comments_template(); ?>-->

    re-enabling comments made the theme work properly again in IE/Chrome.

    any ideas how I can disable comments without messing everything up?

    I found a solution on this very forum!

    Was looking for a solution for this, but didn’t want to go the “all or nothing” approach outlined above. My solution is this:

    Step 1
    Create a new custom field called “allow_comments” and on any pages I want comments give that custom field a value (1, true, allow, whatever).

    Step 2
    Open up your theme’s page.php and find the following line:
    <?php comments_template(); ?>
    Replace with:

    <?php $allow_comments = NULL; $allow_comments = get_post_meta($post->ID,'allow_comments', false); ?>
    <?php if ($allow_comments[0]) { comments_template(); } ?>

    This checks to see if the page has a value for the allow_comments custom field. If it does, it displays the comments.

    With this in place in the page.php file (and not in the single.php file), by default it will not display comments for pages. But by adding the allow_comments custom field with (any) value, the comments mechanism can be quickly enabled for any page.

    Hope that helps someone else.

    I’ve done step 2 which completely fixes the problem but I don’t really understand step 1. Where do I create a new custom field?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Oh dear – been editing a theme via Firefox & just noticed its broken in Chrome’ is closed to new replies.