Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Wordpress - remove metadata from Posts

Posted on 2011-02-22
9
Medium Priority
?
712 Views
Last Modified: 2012-05-11
Hi

I'm building a site for a business and need to remove the date, author, comment numbers, etc. from posts when they are displayed, as the posts dictate the images on the homepage (so they need to be present but not look like blog posts).

Can anyone tell me what I need to delete from single.php to prevent this metadata from being displayed?

(Can post the single.php if needed).

Thanks
0
Comment
Question by:CSHTech
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:CSHTech
ID: 34954750
Code is: -

 get_header(); ?>

<div class="section-container clearfix">

<div class="<?php echo $layout;?> text">

	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		
        <p class="breadcrumb"><?php the_breadcrumb(); ?></p>
                
		<h1 class="index-title"><?php the_title(); ?> <?php edit_post_link('Edit',' / ',''); ?></h1>        
            
        <div <?php post_class('section single') ?> id="post-<?php the_ID(); ?>">
    
            <ul class="meta">          
               <li class="meta-time"><?php the_time('F jS, Y') ?></li>
               <li class="meta-comment"><?php comments_popup_link('Leave a comment &#187;', 'One comment so far &#187;', '% comments &#187;'); ?></li>
            </ul>
            
            <?php the_content('Continue reading &raquo;'); ?>
	
			<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
        
            <div class="navigation clearfix">
                <div class="alignleft"><?php previous_post_link('<p>&laquo; Previous Post</p><p>%link</p>') ?></div>
                <div class="alignright"><?php next_post_link('<p>Next Post &raquo;</p><p>%link</p>') ?></div>
            </div>	
        
            <div id="comments" class="comments">
                <?php comments_template('/comments.php',true); ?>
            </div>
	
		</div><!--Post Ends -->
        
</div><!-- Layout Ends -->


<div class="aside aside-right-image-<?php echo $layout; ?>">
	<?php if ( has_post_thumbnail() ) { ?>
        <?php the_post_thumbnail('single-image'); ?>
    <?php } ?>
	<?php if (strlen($aboutpost) > 0) { ?><h3><?php echo $aboutpost; ?></h3> <?php } else { ?><h3>About this post</h3><?php } ?>	
		<ul>
        	<li class="meta-category">Posted in <?php the_category(', '); ?></li>
		   	<?php the_tags('<li class="meta-tag">Tags: ', ', ', '</li>'); ?>
		</ul>
</div>


<?php endwhile; endif; ?>

<?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>

Open in new window

0
 
LVL 14

Accepted Solution

by:
Dzynit earned 1200 total points
ID: 34954981
It's lines 15 through 18 that need removed, but on the homepage - you'll probably need to paste your index.php code here.

<ul class="meta">          
               <li class="meta-time"><?php the_time('F jS, Y') ?></li>
               <li class="meta-comment"><?php comments_popup_link('Leave a comment &#187;', 'One comment so far &#187;', '% comments &#187;'); ?></li>
            </ul>

Open in new window

0
 

Author Comment

by:CSHTech
ID: 34955211
Thank you. The metadata doesn't appear on the Homepage, so all good there. :)

I've made the change to single.php but when viewing the Post page, you can still see the path to the post above the post: -

Bartholomew » Uncategorized » Post 2

and
 
Previous Post, Next Post and  "comments are closed" caption, as attached screenshot.

Is this editable from single.php also? Screenshot of post area
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Assisted Solution

by:Dzynit
Dzynit earned 1200 total points
ID: 34955280
Yes, comments section is 24 to 27.

<div class="navigation clearfix">
                <div class="alignleft"><?php previous_post_link('<p>&laquo; Previous Post</p><p>%link</p>') ?></div>
                <div class="alignright"><?php next_post_link('<p>Next Post &raquo;</p><p>%link</p>') ?></div>
            </div>

Open in new window


The other is the breadcrumbs, line 9.

<p class="breadcrumb"><?php the_breadcrumb(); ?></p>

Open in new window


The breadcrumbs can be removed by deleting that line, but if you want to alter it - the real code would be in the functions.php file.
0
 
LVL 23

Assisted Solution

by:jeremyjared74
jeremyjared74 earned 800 total points
ID: 34955281
You could also display none using CSS to remove them on all pages posts and categories by adding this to your css
.entry-meta {
display: none !important;
}

Open in new window


You may need to change the selector for the meta. Here is another example:
.meta {
display: none !important;
}

Open in new window


And one more:
.postmeta {
display: none !important;
}

Open in new window


If you can't find your selector, send a link and I will help you.
0
 

Author Comment

by:CSHTech
ID: 34955361
Dzynit,

Deleted the code you advised and it's looking much better, thanks. The only thing left is the lower white area where it says 'comments are closed'. Any thoughts..?

(jeremyjared74: - many thanks for your input)
0
 
LVL 14

Assisted Solution

by:Dzynit
Dzynit earned 1200 total points
ID: 34955531
That's lines 29 thru 31:


<div id="comments" class="comments">
                <?php comments_template('/comments.php',true); ?>
            </div>

Open in new window

0
 
LVL 23

Assisted Solution

by:jeremyjared74
jeremyjared74 earned 800 total points
ID: 34955568
You're welcome, but did you find it?

After looking at your code above I see you need to add this to the style.css:
.meta {
display: none !important;
}

Open in new window

0
 

Author Closing Comment

by:CSHTech
ID: 35093299
Many thanks for your help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question