How To Hide/Delete "Leave a Reply" On Dozens Of Pages

I’m back. I used the CSS Validator but see nothing affecting this CSS code that is currently in my “style.css” :

body.page-id-13758 #comments {
display:none;
}
.category-toonblog #comments {
display: inherit;
}
#respond {
display:none; /* ADD ME per Mittineague */
margin-top: 3.42857rem;
}
.category-toonblog #respond {
display: block;
}

So am wondering if there is any other alternative? I think nothing will work.

Also wondering if I should delete:
/* ADD ME per Mittineague */
is that affecting anything?

UPDATE: I added this to bottom of CSS mentioned above:

div#respond {
display: inherit;
}

and did show the “Leave a Reply” Comments box HOWEVER, across hundreds of other inner pages…so I simply deleted it and back to square one.

Additional thought. Does it matter where I put this code? In “style.css” or in APPEARANCE>EDIT>CSS?

danno2,

I assume that most of your web site is managed by a CMS and that the creation of the blog pages, “latest-news” and "these-are-my-favourites, are created automatically by that CMS or by a database system. Is that correct or am I mistaken?

Do you know what mechanism puts the classes in the <body> tag at the top of each page?
In other words, do you know how it was determined that the <body> tag for
http://dc.cartoonfile.com/category/toonblog/
would have these classes
<body class="archive category category-toonblog category-7015 custom-background custom-font-enabled infinite-scroll neverending infinity-end">
and the <body> tag for most/all of the other pages would have these classes
<body class="single single-post postid-12825 single-format-standard custom-background custom-font-enabled">
and what mechanism does that?

The big question is:
Do you know how to add another class in the <body> tag of those pages where you want the #respond box to be visible:
http://dc.cartoonfile.com/latest-news/
http://dc.cartoonfile.com/these-are-my-favourites/

style.css is a filename (which I understand).

I have no idea what APPEARANCE>EDIT>CSS is. It sounds like tabs from your editor. The thing that matters is the file that is being edited. Hopefully, it is style.css.

That code is completely useless here.

It is hiding ALL of the #respond boxes. It should NOT be deleted.


#respond {
    display:none; /* ADD ME per Mittineague */
    margin-top: 3.42857rem;
}

Yes, that’s the menu for edit using the ACP
I’m wondering if a later referenced file is over-riding the changes, there’s a lot of them and sequence could make a difference.

<link rel='stylesheet' id='pss-tagalphabet-css'  href='http://dc.cartoonfile.com/wp-content/plugins/tag-alphabet/essentials-tag-alphabet.css?ver=1.0' type='text/css' media='screen' />
<link rel='stylesheet' id='jetpack-widgets-css'  href='http://dc.cartoonfile.com/wp-content/plugins/jetpack/modules/widgets/widgets.css?ver=20121003' type='text/css' media='all' />
<link rel='stylesheet' id='jetpack-carousel-css'  href='http://dc.cartoonfile.com/wp-content/plugins/jetpack/modules/carousel/jetpack-carousel.css?ver=20120629' type='text/css' media='all' />
<link rel='stylesheet' id='tiled-gallery-css'  href='http://dc.cartoonfile.com/wp-content/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css?ver=2012-09-21' type='text/css' media='all' />
<link rel='stylesheet' id='mediaelement-css'  href='http://dc.cartoonfile.com/wp-includes/js/mediaelement/mediaelementplayer.min.css?ver=2.13.0' type='text/css' media='all' />
<link rel='stylesheet' id='wp-mediaelement-css'  href='http://dc.cartoonfile.com/wp-includes/js/mediaelement/wp-mediaelement.css?ver=3.8' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-style-css'  href='http://dc.cartoonfile.com/wp-content/themes/twentytwelve-child-01/style.css?ver=3.8' type='text/css' media='all' />
<!--[if lt IE 9]>
<link rel='stylesheet' id='twentytwelve-ie-css'  href='http://dc.cartoonfile.com/wp-content/themes/twentytwelve/css/ie.css?ver=20121010' type='text/css' media='all' />
<![endif]-->
<link rel='stylesheet' id='sharedaddy-css'  href='http://dc.cartoonfile.com/wp-content/plugins/jetpack/modules/sharedaddy/sharing.css?ver=2.7' type='text/css' media='all' />
<link rel="stylesheet" id="custom-css-css" type="text/css" href="http://dc.cartoonfile.com/?custom-css=1&csblog=1&cscache=6&csrev=32" />

And I’m sure I saw more than one “style.css” file before (1 in theme folder, 1 in child-theme folder if not mistaken)

danno2. There are only three things that need to be done and you have already done the first one by setting
#respond {display:none}

Step #2 is to add a class to the <body> tag of those pages whose #respond box should be visible. You have to do that in your CMS.

Yes, there are two.
style.css
and
style.css?ver=3.8

Why is the code for the #respond box being included on so many pages where it is not desired? Why not just include that code only on the pages where comments are desired? That would seem to be better than hiding everything and showing only a few.

Curious…

Thank you RonPat: This site was built to replace [B]my current site[/B] that I built over a decade ago using Frontpage2002. It’s an online image content catalog and specializes in offering thousands of categorized images that can be licensed for dozens of uses in graphics and electronic publishing platforms. I only want to show images and not engage the thousands of pages in commentary. The only intended commentary I prefer to indulge in, would be directly via a blog page.
Over these recent years, I lost so much traffic due to the new html5 hierarchy and also competition and the web editor I used for the current site isn’t even being upgraded by Microsoft for updates anymore…so in essence, I was practically forced into switching to a new platform and since WP is a CMS I decided to jump into it and utilize it’s functionality as best I could.
That being said, it’s been almost a year putting all this together the way you see it from the [B]intended index page[/B] and then of course to my intended blog page. Hope that makes sense. So then my next question is this…when I make each new blog post, I assume I will need to go from the visual tab after I write each future blog post and switch to the “text” tab and add that class to the <body> tag of those pages whose #respond box should be visible.

RonPat: Also, when you asked:
"Why is the code for the #respond box being included on so many pages where it is not desired? Why not just include that code only on the pages where comments are desired? That would seem to be better than hiding everything and showing only a few.

Curious… "
I wasn’t aware that the code for the #respond box was ON all the pages…so how do I “mass delete” that or is it even possible? I ask this, because if I can somehow mass delete that, I can then just include it on pages where comments are desired (like the blog! lol)

Addendum: Yes, I see what you mean now . . . . .the code for the #respond box is throughout the site. So now, if I was to start over…how to delete that from throughout the site and reconfig in the CSS to show it ONLY on toonblog or future blog post pages?

Hi, danno2. Sounds like your new site has been quite an undertaking. Your new site is quite an improvement over the original!

If the class must be added manually, then the process you describe sounds like it would work. I have no practical knowledge of WordPress so I am not familiar with the process (tabs) that you are describing. It would be nicer, though, if the CMS would do that for you.

Ideally, a web page contains only the content that the user is supposed to see. Unnecessary code is considered overhead that takes longer to download and uses up more of some folks byte allowance (bandwidth), so web designers work pretty hard to minimize such things.

This has been an ambitious project and you’ve done well so far. You may want to chat with some folks in the CMS & WordPress forum (http://www.sitepoint.com/forums/forumdisplay.php?266-CMS-amp-Wordpress) about optimizing your site so you do not include the #respond boxes on pages where they are not desired. It sounds to me like improving site efficiency would be time well spent.

This thread can be moved into that forum if you would like. Just click the orange flag in the lower left corner of your post and leave a message to a moderator. You could also wait until @Mittineague checks in again and see if he has anything new to suggest. He has moddie superpowers so he could move it for you, if desired.

Your diligent work will pay off.

Cheers :slight_smile:

I don’t think you can edit the body tag on a per post basis, using the ACP editor or otherwise.
If you’re using the child theme as I think you are, you hopefully will be able to tell which of these files is the template for the page you want and hard-code a unique id into it…
category-7015.php
category.php
content-gallery.php
footer.php
functions.php
header.php
tag.php

Most likely though, the body tag will be in header.php and use the body_class function which is in wp-includes/post-template.php and calls get_body_class found in the same file. get_body_class determines what kind of page it is and returns the classes array to body_class which puts together the class=“…” and returns it to the template file prior to the page being rendered.

If it sounds complicated it’s because it’s not simple.

If you recognize one of the other files as uniquely being for the desired page, you could hard-code an id or unique class into a tag other than the body tag, preferrably one close to the div#respond

Else I’m afraid it will be more or less trial and error until you hit upon the combination of selectors that isn’t being conflicted by another CSS declaration somewhere.
Or write a custom function to tie in with the WP Core code. Again, not so simple.

Hi Mittineague:
I opened my “header.php” and it does in fact show body_class as here is all that’s in it:

<?php
/**
 * The Header template for our theme
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
?><!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>

<body <?php [B][COLOR="#FF0000"]body_class([/COLOR][/B]); ?>>
<div id="page" class="hfeed site">
	<header id="masthead" class="site-header" role="banner">
				<?php if ( get_header_image() ) : ?>
		<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>
		<?php endif; ?>
		<hgroup>
			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
		</hgroup>

		<nav id="site-navigation" class="main-navigation" role="navigation">
			<h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
			<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
			<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
		</nav><!-- #site-navigation -->

	</header><!-- #masthead -->

	<div id="main" class="wrapper">

In the meantime, I am going to look at this information as it looks pretty complicated. Thanks Ron, I appreciated your input!

Also Mittineague: If you can move this to[B][COLOR=“#FF0000”] the forum Ron mentions[/COLOR][/B], please do. Thanks, Dan