Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

eitex on "Conditional Show Dates on Posts"

$
0
0

I would like to show the date and title on all blog posts, except where post_type='resources'. On 'resources' I would like to show no date and title.

I am modifying single.php but unable to get it to work.

The original code looks like this:

<header>
<?php $post_meta = of_get_option('post_meta'); ?>
<?php if ($post_meta=='true' || $post_meta=='') { ?>
<div class="post-meta">
<time datetime="<?php the_time('Y-m-d\TH:i'); ?>"><span><?php the_time('d'); ?></span><?php the_time('M'); ?></time>
<div class="extra-wrap">
<h4>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></h4>
<?php _e('Posted by', 'theme1559'); ?> <span class="author"><?php the_author_posts_link() ?></span>
</div>
<?php comments_popup_link('No comment(s)', '1 comment', '% comment(s)', 'comments-link', ''); ?>
</div><!--.post-meta-->
<?php } ?>
</header>

I tried changing it to this:

<header>
<?php if ($post_type<>'resources' || $post_meta=='true' || $post_meta=='') { ?>
<div class="post-meta">
<time datetime="<?php the_time('Y-m-d\TH:i'); ?>"><span><?php the_time('d'); ?></span><?php the_time('M'); ?></time>
<div class="extra-wrap">
<h4>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></h4>
<?php _e('Posted by', 'theme1559'); ?> <span class="author"><?php the_author_posts_link() ?></span>
</div>
<?php comments_popup_link('No comment(s)', '1 comment', '% comment(s)', 'comments-link', ''); ?>
</div><!--.post-meta-->
<?php } ?>
</header>

I have tried several different ways in fact but just cannot get it to work.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 8245

Trending Articles