0

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):

enter image description here

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:

enter image description here

  • The problem is you're manually wrapping <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. – WebElaine Dec 15 '17 at 20:41
  • @WebElaine Hi thakns for answer, not working, again no <p> elements. This is clear theme, and I'dont disable wpautop – RS92 Dec 15 '17 at 20:46
  • I'm using get_the_content(); , but when set the_content(); It works, but my text are not inside this my div – RS92 Dec 15 '17 at 20:51
  • Solved, I will write answer with solution – RS92 Dec 15 '17 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.