• WhitWhit

    (@whitwhit)


    I actually need to remove it from single-download.php which is a duplicate of single.php so I can’t “display: none;” in the css.

    I’m setting up my thank you and product pages for Easy Digital Downloads. They have it set up to default to a template labeled single-download.php but that of course doesnt exist by default within a theme so its back up choice is single.php. Single.php has the author name, gravatar image and date which I dont want on there so I created a duplicate of single.php, renamed it single-download.php I’ve successfully removed the side bar but can’t figure out how to remove author, gravatar and date. I deleted over half the template but its still showing haha? Idk how but it is.

    Heres what the template looked like before I deleted anything:

    <?php
    /**
     * The template for displaying all single posts.
     *
     * @package sensible-wp
     */
    
    get_header(); ?>
    
    	<?php if (has_post_thumbnail( $post->ID ) ): ?>
    		<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); $image = $image[0]; ?>
    
        	<header class="featured-img-header" data-speed="8" data-type="background" style="background: url('<?php echo $image; ?>') 50% 0 no-repeat fixed;">
        		<div class="grid grid-pad">
            		<div class="col-1-1">
    					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
            		</div><!-- .col-1-1 -->
            	</div><!-- .grid -->
    		</header><!-- .entry-header --> 
    
    		<?php else : ?>
    
            <header class="entry-header">
        		<div class="grid grid-pad">
            		<div class="col-1-1">
    					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
            		</div><!-- .col-1-1 -->
            	</div><!-- .grid -->
    		</header><!-- .entry-header -->
    
    	<?php endif; ?>
    
     	<?php while ( have_posts() ) : the_post(); ?>
    
    	<header class="single-blog-entry-header">
    		<div class="entry-meta">
    			<?php _e( 'Posted by, ', 'sensible-wp' ); ?><?php the_author(); ?><?php echo get_avatar( get_the_author_meta('email'), get_the_author() ); ?>
                <?php _e( 'on ', 'sensible-wp' ); ?><?php the_date(); ?>
    		</div><!-- .entry-meta -->
    	</header><!-- .entry-header -->
    
    	<div class="grid grid-pad">
    		<div id="primary" class="content-area col-1-1">
    			<main id="main" class="site-main" role="main">
    
    			<?php get_template_part( 'content', 'single' ); ?>  
    
    			<?php sensiblewp_post_nav(); ?>
    
    			<?php
    				// If comments are open or we have at least one comment, load up the comment template
    				if ( comments_open() || get_comments_number() ) :
    					comments_template();
    				endif;
    			?>
    
    		<?php endwhile; // end of the loop. ?>
    
    			</main><!-- #main -->
    		</div><!-- #primary -->
    
    	</div><!-- grid -->
    	<?php get_footer(); ?>

    Here’s what it looks like after I deleted all the author stuff (or so I thought)

    <?php
    /**
     * The template for displaying all single posts.
     *
     * @package sensible-wp
     */
    
    get_header(); ?>
    
    	<?php if (has_post_thumbnail( $post->ID ) ): ?>
    		<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); $image = $image[0]; ?>
    
        	<header class="featured-img-header" data-speed="8" data-type="background" style="background: url('<?php echo $image; ?>') 50% 0 no-repeat fixed;">
        		<div class="grid grid-pad">
            		<div class="col-1-1">
    					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
            		</div><!-- .col-1-1 -->
            	</div><!-- .grid -->
    		</header><!-- .entry-header --> 
    
    		<?php else : ?>
    
            <header class="entry-header">
        		<div class="grid grid-pad">
            		<div class="col-1-1">
    					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
            		</div><!-- .col-1-1 -->
            	</div><!-- .grid -->
    		</header><!-- .entry-header -->
    
    			</main><!-- #main -->
    		</div><!-- #primary -->
    
    	</div><!-- grid -->
    	<?php get_footer(); ?>

    Here’s the chunk I removed:

    <?php endif; ?>
    
     	<?php while ( have_posts() ) : the_post(); ?>
           <header class="single-blog-entry-header">
    <div class="entry-meta">
    			<?php _e( 'Posted by, ', 'sensible-wp' ); ?><?php the_author(); ?><?php echo get_avatar( get_the_author_meta('email'), get_the_author() ); ?>
                <?php _e( 'on ', 'sensible-wp' ); ?><?php the_date(); ?>
    		</div><!-- .entry-meta -->
    	</header><!-- .entry-header -->
    
       <?php _e( 'Posted by, ', 'sensible-wp' ); ?><?php the_author(); ?><?php echo get_avatar( get_the_author_meta('email'), get_the_author() ); ?>
                <?php _e( 'on ', 'sensible-wp' ); ?><?php the_date(); ?>
                <div class="grid grid-pad">
    		<div id="primary" class="content-area col-1-1">
    			<main id="main" class="site-main" role="main">
    
    			<?php get_template_part( 'content', 'single' ); ?>  
    
    			<?php sensiblewp_post_nav(); ?>
    
    			<?php
    				// If comments are open or we have at least one comment, load up the comment template
    				if ( comments_open() || get_comments_number() ) :
    					comments_template();
    				endif;
    			?>
    
    		<?php endwhile; // end of the loop. ?>

    Anybody know what Im missing here? Thank you!!

  • The topic ‘How to remove author, gravatar and date from single.php?’ is closed to new replies.