Home Forums General Issues Wysiwyg textarea + Crayon Syntax Highligther


Wysiwyg textarea + Crayon Syntax Highligther

  • I’m trying to build an index (cheat sheet) for basic HTML coding and I’m using the Crayon Syntax Highlighter plugin to display the code. I am using a repeater field with one WYSIWYG textarea that includes the code that I want to display. I’ve followed this tip on how to style the code with Crayon but it doesn’t seem to work ( Any tips?

    This is my current code:

    <div class="entry-content" itemprop="text">
    	<?php if( have_rows('cheat') ): ?>
    		<div class="row">
    			<?php while ( have_rows('cheat') ) : the_row(); ?>
    				<div class="col-md-4">
    					<h2><?php the_sub_field('titel') ?></h2>	
    					<?php the_sub_field('uitleg') ?>
    					<?php echo CrayonWP::highlight(the_sub_field('code')); ?>
    			<?php endwhile; ?>
    	<?php endif; ?>
  • The line should use get_sub_field() instead of the_sub_field()

    <?php echo CrayonWP::highlight(get_sub_field('code')); ?>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.