Forums

How can I put text (HTML) in my posts that only appear if viewed individually (4 posts)

  1. lrflew
    Member
    Posted 2 years ago #

    Without using the get_excerpt(), I want to put something in the middle that is only viewable when viewed on it's own page. Yes this needs to be able to use HTML commands. I tried using "<?php if (is_single()) : ?>Text Here<?php endif; ?>" but it didn't work. Any ideas?

  2. iridiax
    Member
    Posted 2 years ago #

    You can't use php in a post without a plugin:

    http://wordpress.org/extend/plugins/search.php?q=php

    As for the format, don't use endif. See:

    http://codex.wordpress.org/Conditional_Tags

  3. Xamataca
    Member
    Posted 2 years ago #

    There are a couple of ways to do this:
    - Use the <!-- more --> tag at editor so you can use the_content():
    http://codex.wordpress.org/Template_Tags/the_content
    - Use a custom field:
    http://codex.wordpress.org/Using_Custom_Fields

  4. lrflew
    Member
    Posted 2 years ago #

    @iridiax: Plugin might work. I might try that.

    @Xamataca: neither of those does what I need, but thanks.

    One of the reasons I wanted to do this was that I can post 'updates'. When I add something to a page, I will add a post on the current day saying I made the change (but only when I want to). When they click on the post that would normally view the post, the 'is_single()' would link them to the original post. If there is another way to do this, please tell me.

Topic Closed

This topic has been closed to new replies.

About this Topic