get_the_content working with line breaks
-
Hi guys,
I’m having problem with get_the_content. It doesn’t work with line breaks or white lines. Here is what I’m trying to do:My goal is to show a post’s content in an article when a user clicks on a link containing the post’s title. It works allright unless there is a line break or a white line in the post. Here is the code:
<?php $posts=get_posts(); echo '<ul id="links">'; foreach($posts as $post) : setup_postdata($post); ?> <li onclick="document.getElementsByTagName('article')[0].innerHTML='<?php echo get_the_content(); ?>'"><a href='#''><?php the_title(); ?></a></li> <?php endforeach; echo '</ul>'; ?>
So how do I get it to work also with line breaks and/or whitelines?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_the_content working with line breaks’ is closed to new replies.