WordPress.org

Ready to get started?Download WordPress

Forums

Conditional display on every post page but latest (4 posts)

  1. chacsam
    Member
    Posted 6 years ago #

    Hello,

    I have been developping a new template for my blog (http://www.chacsam.be) with an information frame on the sidebar of the detail page.
    I would like to avoid displaying the link to the next post (including button which is a customization) on the latest one.

    Which command should I implement?

    I guess it can be something around
    <?php if (???()) : ?><li class="artnext"><?php next_post_link('%link'); ?></li> <?php endif; ?>

    But what should I put instead of the ???. Or isn't it that easy

  2. satchel
    Member
    Posted 5 years ago #

    I have the same question. I suppose most people just use the next_post_link tag by itself, which works fine if your next post and previous post sections don't contain a bunch of nested divs and graphics attached. But if they do, you ought to be able to create some sort of conditional using the next_post_link tag or something related.

    I've tried
    <?php if (next_post_link() != '') : ?>

    and
    <?php if (next_post_link()) : ?>

    neither of which cause a PHP error, but both of which wreak havoc on the CSS. Also, I've solved the equivalent problem on the index page by using the magic code

    <?php if (!(is_home() && !is_paged())) : ?>
    which I found elsewhere in these forums. Can anyone help?

  3. WebTechGlobal
    Member
    Posted 5 years ago #

    This forum should just be closed it is pathetic how many questions don't even get a quick linked dropped in to help you move on from your problem.

    Anyway how about this...

    <?php
    $demo = get_post_meta($post->ID, 'demo', true);
    if ($demo == '')
    { ?>

    <?php } else { ?>

    <div class="containerX"><table border="0" cellspacing="0" cellpadding="5" class="downAlign">
    <tr>
    <td>ID, "demo", true ); ?>" title="Demo"><img src="<?php bloginfo( 'template_directory' ); ?>/images/demo.png" class="none" alt="Demo" /></td>
    <td align="left">  ID, "demo", true ); ?>" class="postDeets" title="Demo">Demo
      <span class="underDeet">See our demo</span></td>
    <td>ID, "download", true ); ?>" title="Download"><img src="<?php bloginfo( 'template_directory' ); ?>/images/download.png" class="none" alt="Demo" /></td>
    <td align="left">  ID, "download", true ); ?>" class="postDeets" title="Download">Download
      <span class="underDeet">Get the source</span></td>
    </tr>
    </table></div>
    <?php } ?>

  4. WebTechGlobal
    Member
    Posted 5 years ago #

    You need to create custom field DEMO for example. Got it off another post but lost the link after closing the tab there!

Topic Closed

This topic has been closed to new replies.

About this Topic