• Hi guys,

    I’m trying to hide the post text and “Continue reading →” from the homepage.
    I tried to hide it using CSS in several ways and in the end I decided that it’s a little bit messy.
    I tried to delete the PHP code that is responsible of showing it and now, and it worked, but it also deleted the text in the post itself so no text anywhere.

    what is the most simple way to do it?

    p.s: all the posts at my blog start with the “more” tag. so the only thing that shows up is the “Continue reading →”.
    p.s #2: I’m using twentyfourteen theme that I customize.
    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • what is the most simple way to do it?

    depends on the currently used theme.

    http://codex.wordpress.org/Forum_Welcome#Include_as_much_information_as_possible

    Thread Starter hAtul

    (@free269)

    ^ exactly edited my post about it, noticed I didn’t write what theme.

    you want to remove the ‘continue reding’ text but keep the functionality?

    if so, one possibility could be to edit content.php in a child theme (http://codex.wordpress.org/Child_Themes ) and change this line (line 54):

    the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );

    to:

    if( is_home() ) { the_content( ' ' );
    			} else { the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); }

    Thread Starter hAtul

    (@free269)

    Thank you alchymyth for your response.
    But it didn’t really help.
    I’ll explain:
    In my homepages blog I only view the headline of the post and the image.
    The first thing that I did was to start every post in my blog with the “more” tag and delete the “Continue reading <span class=”meta-nav”>→</span>” from:

    the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );

    So it wont show up. The problem is – that the div of the content still shows up, but shows up empty – takes place in my design, and if I edit it and give it a defined height using CSS – it affects the div when viewing the full post page.
    When I try hiding it using CSS (using visibilaty or display), it hides the content, but it hides the content inside the full post page.

    Thread Starter hAtul

    (@free269)

    I have an idea. but im new with php. so maybe you can help me.

    I want to check if it’s the home page.
    If it is the homepage so don’t run the <div class=”entry-content”> at all.

    (or if it’s not the homepage so run <div class=”entry-content”>. but this will be the only condition).

    How do I do it?

    edit:
    did the code myself I think it works 🙂

    <?php if ( is_search() ) : ?>
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div><!-- .entry-summary -->
    	<?php elseif ( is_home()==false )  : ?>
    	 <div class="entry-content">
    		<?php
    			the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    			) );
    		?>
    	</div>
    	<!-- .entry-content
    	<?php endif; ?>

    you could use CSS to selectively remove the ‘continue reading’ just from the home page, based on the CSS class output by body_class() http://codex.wordpress.org/Function_Reference/body_class :

    .home .more-link { display: none; }

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide post text and "Continue reading →" from the homepage’ is closed to new replies.