Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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; ?>
        </article>

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

 
discard

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

Browse other questions tagged or ask your own question.