WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently pulling in the latest post on a category page based on which category you click on. When you click on the category "Code Examples" you see this:

enter image description here

I am using the Crayon syntax highlighter plugin, which works fine, but when I use the following code to pull in the above content, it doesn't look the same as it does on the actual post page (below):

enter image description here

$post_content = get_post($post->ID);
    // format the raw data
    $content = sanitize_post_field('post_content', $post_content->post_content, $post->ID, 'display');
    <div id="docs-category-page">
        <article id="docs-post">
        <h1 class="entry-title"><?php echo get_the_title($post->ID); ?></h1>
            <?php echo $content; ?>

I have looked up apply filters, etc, but since Crayon plugin uses JS for its functionality, the data from get posts doesn't look the same... Need a remedy and fast! Thanks!

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.