Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter thebookreporter

    (@thebookreporter)

    Thread Starter thebookreporter

    (@thebookreporter)

    Thanks alchymyth, that worked like a charm.

    Cheers,
    Aaron

    Thread Starter thebookreporter

    (@thebookreporter)

    Thanks all.

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. wait. alchymth, I’ve just tried your solution with a different ad code and it is working, so it appears there’s something wrong with the ad code I was using. Thank you for the solution. I’ll have to contact my ad company and ask them to fix the code. Thanks again for your patience.

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. I’ve just added the code into my index.php (just before <?php endwhile; ?>) and I’ll leave it there for now. I’ve added other ad codes onto my site in other places, and they always show up as ‘advertise here’ on the site. You can see this text just beneath the banner ad beneath the header and beneath the poster ad near the top of the sidebar.

    Thread Starter thebookreporter

    (@thebookreporter)

    Thanks marviepons, but I’m afraid that didn’t work either.

    Thread Starter thebookreporter

    (@thebookreporter)

    Thank you both for your suggestions. However, I’m afraid neither worked. I’m not sure if this will help but my ad code is as follows:

    <script language="javascript" src="https://cache.blogads.com/935376472/feed.js"></script>

    Thread Starter thebookreporter

    (@thebookreporter)

    Thank you for your response. I do have a child theme that I could make the changes on.

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. things seem to be back to normal. I’m not exactly sure what happened but it looks like my functions.php file was corrupted. I’ve restored it, and the problem appears to be fixed. Thanks for all your help and patience.

    Thread Starter thebookreporter

    (@thebookreporter)

    Yes, that code is just there to make sure the margins in my posts conforms to the margins of my pages. I needed to add it after I added the sidebar to my posts because otherwise the margins in my posts were way off. This is because I had changed the margins of my pages a bit from the template (on my child theme). I did this by adding the following code to my css:

    .left-sidebar #primary {
    float: right;
    margin: 0 0 0 -30.4%; /* increased left margin 4% from -26.4% to -30.4% */
    width: 100%;
    }
    .left-sidebar #content {
    margin: 0 5% 0 38%; /* increased right margin 4% from 34* to 38% */
    width: 58.4%;
    }
    .left-sidebar #secondary {
    float: left;
    margin-left: 5%;
    margin-right: 0;
    margin-top: 20px;
    width: 22.8%; /* increased sidebar width 4% from 18.8% to 22.8% */
    }

    I have since amended this code in my css to include the color code that you provided. I’m not sure how I would have to change my css in order to make sure the margins in my posts matches the margins of my pages?

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. adding the background-color: #fff; worked to preserve the color of my background, but the margins are way off. When I go back into my functions.php and add my

    <?php
    add_filter(‘body_class’, ‘blacklist_body_class’, 20, 2);
    function blacklist_body_class($wp_classes, $extra_classes) {
    if( is_single() || is_page() ) :
    // List of the classes to remove from the WP generated classes
    $blacklist = array(‘singular’);
    // Filter the body classes
    foreach( $blacklist as $val ) {
    if (!in_array($val, $wp_classes)) : continue;
    else:
    foreach($wp_classes as $key => $value) {
    if ($value == $val) unset($wp_classes[$key]);
    }
    endif;
    }
    endif; // Add the extra classes back untouched
    return array_merge($wp_classes, (array) $extra_classes);
    }

    the margins return to normal but I lose my background color! Sorry about this. It’s a thorny problem.

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k., so my site is alive again (thank you). Now the only problem I have is with the sidebar. As I mentioned, when I try to add the <?php get_sidebar(); ?> code to my single.php (just above the <?php get_footer(); ?>) the sidebar shows up on my posts but the margins get thrown off and I lose my white foreground color.

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. When I add just the <?php get_sidebar(); ?> code to my single.php I do get the sidebar on my posts, but the proper margins get thrown way off. I have modified my margins in my CSS using the following code:

    .left-sidebar #primary {
    float: right;
    margin: 0 0 0 -30.4%; /* increased left margin 4% from -26.4% to -30.4% */
    width: 100%;
    }
    .left-sidebar #content {
    margin: 0 5% 0 38%; /* increased right margin 4% from 34* to 38% */
    width: 58.4%;
    }
    .left-sidebar #secondary {
    float: left;
    margin-left: 5%;
    margin-right: 0;
    margin-top: 20px;
    width: 22.8%; /* increased sidebar width 4% from 18.8% to 22.8% */
    }

    Now something really bad happened, though. My site has gone completely blank. When I try to remove the last change I made (reintroducing the <?php get_sidebar(); ?> into my single.php) the site remains blank. Things are quite bad here…

    Thread Starter thebookreporter

    (@thebookreporter)

    When I remove the 2 codes the problem disappears. However, what the 2 codes were for was to be able to add my sidebar to my posts. I would still like my sidebar on my posts, so I still need to figure out how to do this without reintroducing the offending code.

    The strange thing is that even with the 2 codes removed, when I try to change one of my pages from default mode to sidebar mode, the problem reappears on that page and I lose the white color of my foreground (while gaining the sidebar). This makes me think that the problem goes deeper than just the 2 codes that I’ve removed, but this is just a guess. Thanks a lot for your help btw, any ideas?

    Thread Starter thebookreporter

    (@thebookreporter)

    O.k. I’ve discovered the culprit. It has to do with my sidebar. I’ve imported my sidebar into all of my pages by way of adding

    <?php get_sidebar(); ?>

    above the

    <?php get_footer(); ?>

    in the Single Post file of my child theme (single.php). And also adding the following code into the Theme Functions file of my child theme (functions.php), which I think makes room for the added sidebar content:

    <?php
    add_filter('body_class', 'blacklist_body_class', 20, 2);
    function blacklist_body_class($wp_classes, $extra_classes) {
    if( is_single() || is_page() ) :
    // List of the classes to remove from the WP generated classes
    $blacklist = array('singular');
    // Filter the body classes
      foreach( $blacklist as $val ) {
        if (!in_array($val, $wp_classes)) : continue;
        else:
          foreach($wp_classes as $key => $value) {
          if ($value == $val) unset($wp_classes[$key]);
          }
        endif;
      }
    endif;   // Add the extra classes back untouched
    return array_merge($wp_classes, (array) $extra_classes);
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I feel like the problem has to be stemming from the functions.php modification I made, but I don’t know how. Any suggestions?

Viewing 15 replies - 1 through 15 (of 20 total)