Wordpress version: 4.8.4 (I wouldn't like to update to 4.9.1, because that version have bug with Template Name inside pages.)
I've created custom theme in Wordpress and have problem with textual editor inside my custom post (Created by CPT UI):
My code in .php:
<!-- Section - About -->
<section class="container">
<?php
$query = new WP_Query(array(
'post_type' => 'o_nama',
'post_status' => 'publish'
));
while ($query->have_posts()) {
$query->the_post();
$title= get_the_title();
$content= get_the_content();
?>
<article class="column">
<div class="columns left">
<img src="<?php the_field('slika_o_nama_post'); ?>" alt="Slika">
</div>
<div class="columns columns__8">
<div class="content">
<h1><?php echo $title; ?></h1>
<p><?php echo $content; ?></p>
</div>
</div>
<div class="columns right">
<img src="<?php the_field('slika_o_nama_post'); ?>" alt="Slika">
</div>
</article>
<?php
}
wp_reset_query();
?>
</section>
Problem is "paragraph 2." because, when I check in developer tools in Chrome, this second paragraph are not inside
element, and my style from css not applied to this textual content. Rest elements look fine, but there is problem only with each paragraph after first, I've set in text editor to be paragraph but not working.
There is screenshot from developer tools:
<p></p>
tags in the line<p><?php echo $content; ?></p>
. Instead try simply<?php the_content(); ?> and make sure you have not disabled
wpautop` which should add the<p></p>
tags for you.