Solved

Wordpress - remove metadata from Posts

Posted on 2011-02-22
9
700 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 300 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
 
LVL 14

Assisted Solution

by:Dzynit
Dzynit earned 300 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 23

Assisted Solution

by:jeremyjared74
jeremyjared74 earned 200 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 300 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 200 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Button Click 11 26
Why does my array not "dump?" 5 19
Web Reply Form - PHP with Upload 4 20
PHP JSON Clean up 5 10
WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The viewer will learn how to count occurrences of each item in an array.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now