• austraysia

    (@austraysia)


    Hey guys!

    I’m pretty new to wordpress and wanted to some changes to my post. In fact I wanted to remove the timestamp, author and meta information in a single post, not for all the posts.
    I found out how to remove them completely, but, as I said, I just want to remove it from one single post.
    Is that somehow possible?

    Thanks in advance.

Viewing 12 replies - 1 through 12 (of 12 total)
  • thelastknight

    (@thelastknight)

    You can use conditional tags. First find the ID of the post.

    Inside the single.php file add around the bit which you want to remove from the post. Replace ’17’ with your post ID.

    <?php if (is_single('17')) { ?>
    
    //nothing happens
    
    <?php } else { ?>
    
    // the code for you meta info
    
    <?php } ?>
    Thread Starter austraysia

    (@austraysia)

    Thanks a lot!!!
    That’s exactly what I was looking for =)

    Thread Starter austraysia

    (@austraysia)

    Hmm… ok, it actually didn’t quite worked as I thought it would.
    So, this is how the code looks like:

    <?php get_header(); ?>
    
    	<div id="primary" class="single">
    
    		<?php if(have_posts()) : ?>
    
    		<?php while(have_posts()) : the_post(); ?>
    
    		<div id="post-<?php the_ID(); ?>" <?php if (function_exists('post_class')) { post_class('entry'); } else {echo 'class="entry hentry"';} ?>>
    
    <?php if (is_single('118')) { ?>
    
    //nothing happens
    
    <?php } else { ?>
    
    // the code for you meta info
    
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    
    			<div class="entry-byline">
    				<span class="entry-date"><abbr class="updated" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('M jS, Y'); ?></abbr></span>
    				<address class="author vcard"><?php _e('by '); ?><a class="url fn" href="<?php the_author_url(); ?>"><?php the_author(); ?></a>. </address>
    				<?php edit_post_link('Edit', '[', ']'); ?>
    			</div>
    <?php } ?>
    			<div class="entry-content">
    				<?php the_content('[Continue reading ⇒]'); ?>
    				<?php wp_link_pages('before=<p><strong>' . __('Pages:') . '</strong>&after=</p>'); ?>
    			</div>
    
    			<p class="entry-meta"><span class="entry-categories"><?php _e('Posted in: '); ?><?php the_category(', '); ?>.</span><br />
    			<?php if(function_exists('the_tags')) { ?>
    				<span class="entry-tags"><?php the_tags('Tagged: ',' &middot; ','<br />'); ?></span>
    			<?php } ?></p>
    
    		</div><!--.entry-->
    
    		<?php include (TEMPLATEPATH . '/navigation.php'); ?>
    
    		<?php comments_template(); ?>
    
    		<?php endwhile; ?>
    
    		<?php else : ?>
    
    		<div class="entry">
    			<h2 class="entry-title"><?php _e('Not Found'); ?></h2>
    			<div class="entry-content">
    			<p>Sorry, what you are looking for isn't here.</p>
    			<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    			</div>
    		</div>
    
    		<?php endif; ?>	
    
    	</div><!--#primary-->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    So, it says if it’s post 118 nothing will happen, otherwise the meta information will show. However the post with id=118 still shows all the information.

    Thread Starter austraysia

    (@austraysia)

    bump

    Thread Starter austraysia

    (@austraysia)

    Sorry to bug again, but I still can’t figure it out.

    Thread Starter austraysia

    (@austraysia)

    bump

    Thread Starter austraysia

    (@austraysia)

    Still need help, please!

    Thread Starter austraysia

    (@austraysia)

    Ok, I found out that it has nothing to do with the single.php file. I deleted EVERYTHING in the single.php file and it still shows all the posts, therefore it can’t be the single.php file which I have to edit… well…

    Thread Starter austraysia

    (@austraysia)

    Ok, I get it now.
    If I changed anything in single.php it only takes effect on a single post. Meaning: It only changed the post after I clicked on it.
    But if I want to change anything in the front page, I have to change the index.php file. But somehow it doesn’t work in the index.php file. It works fine for a single post.
    Anyone know how to remove timestamps in the index.php file for a single post?

    Thread Starter austraysia

    (@austraysia)

    bump
    Need a function, which defines a post.
    is_single(”) doesn’t work.

    nuclearscott

    (@nuclearscott)

    I played around with this a little and couldn’t get the is_single to work either. A work around I found was to create a new category, add the post you want to that category and then do something similiar to before but change it to in_category. This way might be better since you can add other posts to that category in the future instead of hard coding it.

    <?php if (in_category('3')) { ?>
    
    //nothing happens
    
    <?php } else { ?>
    
    // the code for you meta info
    
    <?php } ?>

    Let me know if this works. I am not real familiar with word press yet so I could be way off here.

    -Scott

    Thread Starter austraysia

    (@austraysia)

    Wow… yea that’s a nice trick!
    It worked just fine. I was kinda frustrated so I hardcoded everything… but this is nice =)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove timestamp, author and meta’ is closed to new replies.