• Hi, who knows how to hide post content on home page, category and archive pages, but the post content can show only in single posts? Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • use body class in single page the class is “single” whereas in all other pages its different??

    Thread Starter neverhurry

    (@neverhurry)

    Hi Virendra930, thank you so much, but I am sorry I made a mistake. I didn’t mean in single pages, but single posts, will that be different?

    Thread Starter neverhurry

    (@neverhurry)

    I am using twenty twelve theme, do you know where should I look for body class? Thanks.

    Do not edit the theme itself. First create a child theme for your changes. Or install a custom CSS plugin.

    yes neverhurry .single class is for single post only or you can find its code in single.php in your theme

    Thread Starter neverhurry

    (@neverhurry)

    Thanks esmi, i do have created a child theme.
    virendra930, I have checked the single.php but I didn’t find .single class there. I am using twenty twelve theme.
    Anybody knows what is the code for condition “If any single Post, then…” ?

    Thread Starter neverhurry

    (@neverhurry)

    I found in content.php of twenty twelve theme these codes:

    <?php if ( is_search() ) : // Only display Excerpts for Search ?><br />
    		<div class="entry-summary"><br />
    			<?php the_excerpt(); ?><br />
    		</div><!-- .entry-summary --><br />
    		<?php else : ?><br />
    		<div class="entry-content"><br />
    			<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?><br />
    			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?><br />
    		</div><!-- .entry-content --><br />
    		<?php endif; ?>

    Now what I think logically, if I could only write a condition code – “If any single Post – after “<?php else : ?>”

    Thread Starter neverhurry

    (@neverhurry)

    Hi, I am not sure, I have no confidence, if the following codes are OK, pls help:

    <?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php elseif ( is_single() ) : ?>
    		<div class="entry-content">
    			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>

    Are you using a child theme?

    Thread Starter neverhurry

    (@neverhurry)

    Thanks ESMI, I tried it, it works!

    Hi can anyone tell me how to hide the contents of a page using “page-id” ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Hide post content on home page’ is closed to new replies.