Forums

[resolved] Show Post Content With HTML codes Visible (6 posts)

  1. effectivesitemarketing
    Member
    Posted 1 year ago #

    Hi,

    I'm creating a new article database site and on each articles page want to show the article with html tags functioning normally (so you see links normally) then another version below it with the html tags being displayed (so people can copy them correctly).

    Any ideas?

    Thanks!

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    use a plugin like syntax highlighter for posting code (bonus, its pretty, here's an example http://go.rvoodoo.com/WPformats )

    or here's some info
    http://codex.wordpress.org/Writing_Code_in_Your_Posts

  3. effectivesitemarketing
    Member
    Posted 1 year ago #

    Hey Rev.
    Thanks.
    That could work if it were just myself, but other people will be posting as well and I can't expect them to use the code tags so it will have to be something hard coded into the page that reprints the article a second time while also printing the full code instead of acting on it.

  4. alchymyth
    The Sweeper
    Posted 1 year ago #

    this or something similar might work:

    <?php the_content(); ?>
    <?php echo apply_filters('the_content','[html]'.$post->post_content.'[/html]'); ?>

    the syntax is aimed at the http://wordpress.org/extend/plugins/syntaxhighlighter/

    (add your own html to the code, if needed for formatting)

  5. effectivesitemarketing
    Member
    Posted 1 year ago #

    that's amazing thank you alchymyth. Exactly the sort of thing I was looking for.

    There's just one problem with the setup. You can see it on the page http://www.republisharticles.com/article-how-to-handle-patronizing-behavior/
    when the code is shown it includes the tags
    <pre class="brush: xml; title: ;" title=""> and '' which messes up the formatting. I've tried looking at the code for the syntaxhighlighter plugin but haven't had any luck removing it.

    Any ideas?

  6. effectivesitemarketing
    Member
    Posted 1 year ago #

    sorry got it working. it's in a text box and didn't need the syntax highlighter [html] tags there.

    Perfect now thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic