WordPress theme is not allowing HTML in my content












0















I have a blog running on MemberPress and I am trying to add a
in the content of my blog posts to add a new paragraph.



When I add the < br / > it does not work, see the image.



My theme does not seem to be rendering the HTML in the post. I tried the visual editor and the text editor.



Do I need to add something to my PHP code to make my posts show the HTML I enter?



Here is the PHP for the blog content:



<div class="entry-content">
<div class="entry-meta ht-post-info">
<?php total_posted_on(); ?>
</div><!-- .entry-meta -->

<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
</header><!-- .entry-header -->

<div class="entry-categories">
<?php echo total_entry_category(); // WPCS: XSS OK. ?>
</div>


<!-- .entry-content -->

<div class="entry-summary" style="margin-left: 13%; margin-top: 2%;">
<?php
if(has_category('premium', $wp_query->post->ID)){
echo do_shortcode("[mepr-active rule='282' ifallowed='show' unauth='message' unauth_message='This content is for authorized members only.']". esc_html(wp_trim_words( get_the_content(), 490 ))."[/mepr-active]");
}else{
echo esc_html(wp_trim_words( get_the_content(), 490 ));
}

?>
</div>
</div>


This is the post that showing 3 lines on one:



the post showing 3 lines on one










share|improve this question





























    0















    I have a blog running on MemberPress and I am trying to add a
    in the content of my blog posts to add a new paragraph.



    When I add the < br / > it does not work, see the image.



    My theme does not seem to be rendering the HTML in the post. I tried the visual editor and the text editor.



    Do I need to add something to my PHP code to make my posts show the HTML I enter?



    Here is the PHP for the blog content:



    <div class="entry-content">
    <div class="entry-meta ht-post-info">
    <?php total_posted_on(); ?>
    </div><!-- .entry-meta -->

    <header class="entry-header">
    <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
    </header><!-- .entry-header -->

    <div class="entry-categories">
    <?php echo total_entry_category(); // WPCS: XSS OK. ?>
    </div>


    <!-- .entry-content -->

    <div class="entry-summary" style="margin-left: 13%; margin-top: 2%;">
    <?php
    if(has_category('premium', $wp_query->post->ID)){
    echo do_shortcode("[mepr-active rule='282' ifallowed='show' unauth='message' unauth_message='This content is for authorized members only.']". esc_html(wp_trim_words( get_the_content(), 490 ))."[/mepr-active]");
    }else{
    echo esc_html(wp_trim_words( get_the_content(), 490 ));
    }

    ?>
    </div>
    </div>


    This is the post that showing 3 lines on one:



    the post showing 3 lines on one










    share|improve this question



























      0












      0








      0








      I have a blog running on MemberPress and I am trying to add a
      in the content of my blog posts to add a new paragraph.



      When I add the < br / > it does not work, see the image.



      My theme does not seem to be rendering the HTML in the post. I tried the visual editor and the text editor.



      Do I need to add something to my PHP code to make my posts show the HTML I enter?



      Here is the PHP for the blog content:



      <div class="entry-content">
      <div class="entry-meta ht-post-info">
      <?php total_posted_on(); ?>
      </div><!-- .entry-meta -->

      <header class="entry-header">
      <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
      </header><!-- .entry-header -->

      <div class="entry-categories">
      <?php echo total_entry_category(); // WPCS: XSS OK. ?>
      </div>


      <!-- .entry-content -->

      <div class="entry-summary" style="margin-left: 13%; margin-top: 2%;">
      <?php
      if(has_category('premium', $wp_query->post->ID)){
      echo do_shortcode("[mepr-active rule='282' ifallowed='show' unauth='message' unauth_message='This content is for authorized members only.']". esc_html(wp_trim_words( get_the_content(), 490 ))."[/mepr-active]");
      }else{
      echo esc_html(wp_trim_words( get_the_content(), 490 ));
      }

      ?>
      </div>
      </div>


      This is the post that showing 3 lines on one:



      the post showing 3 lines on one










      share|improve this question
















      I have a blog running on MemberPress and I am trying to add a
      in the content of my blog posts to add a new paragraph.



      When I add the < br / > it does not work, see the image.



      My theme does not seem to be rendering the HTML in the post. I tried the visual editor and the text editor.



      Do I need to add something to my PHP code to make my posts show the HTML I enter?



      Here is the PHP for the blog content:



      <div class="entry-content">
      <div class="entry-meta ht-post-info">
      <?php total_posted_on(); ?>
      </div><!-- .entry-meta -->

      <header class="entry-header">
      <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
      </header><!-- .entry-header -->

      <div class="entry-categories">
      <?php echo total_entry_category(); // WPCS: XSS OK. ?>
      </div>


      <!-- .entry-content -->

      <div class="entry-summary" style="margin-left: 13%; margin-top: 2%;">
      <?php
      if(has_category('premium', $wp_query->post->ID)){
      echo do_shortcode("[mepr-active rule='282' ifallowed='show' unauth='message' unauth_message='This content is for authorized members only.']". esc_html(wp_trim_words( get_the_content(), 490 ))."[/mepr-active]");
      }else{
      echo esc_html(wp_trim_words( get_the_content(), 490 ));
      }

      ?>
      </div>
      </div>


      This is the post that showing 3 lines on one:



      the post showing 3 lines on one







      php wordpress






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 2:10









      kit

      1,1063816




      1,1063816










      asked Nov 23 '18 at 1:35









      Tony VodickaTony Vodicka

      34




      34
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The wp_trim_words function you're using strips all HTML tags out.



          https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/formatting.php#L3359



          $text = wp_strip_all_tags( $text );


          (Even if it didn't, your use of the esc_html function after it would also break your HTML tags in the post.)






          share|improve this answer
























          • Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

            – Tony Vodicka
            Nov 23 '18 at 2:26











          • If you want to use HTML, you'll have to remove both.

            – ceejayoz
            Nov 23 '18 at 2:27











          • Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

            – Tony Vodicka
            Nov 23 '18 at 2:34













          • @TonyVodicka Just remove the two function calls. echo get_the_content();

            – ceejayoz
            Nov 23 '18 at 2:35











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439708%2fwordpress-theme-is-not-allowing-html-in-my-content%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The wp_trim_words function you're using strips all HTML tags out.



          https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/formatting.php#L3359



          $text = wp_strip_all_tags( $text );


          (Even if it didn't, your use of the esc_html function after it would also break your HTML tags in the post.)






          share|improve this answer
























          • Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

            – Tony Vodicka
            Nov 23 '18 at 2:26











          • If you want to use HTML, you'll have to remove both.

            – ceejayoz
            Nov 23 '18 at 2:27











          • Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

            – Tony Vodicka
            Nov 23 '18 at 2:34













          • @TonyVodicka Just remove the two function calls. echo get_the_content();

            – ceejayoz
            Nov 23 '18 at 2:35
















          0














          The wp_trim_words function you're using strips all HTML tags out.



          https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/formatting.php#L3359



          $text = wp_strip_all_tags( $text );


          (Even if it didn't, your use of the esc_html function after it would also break your HTML tags in the post.)






          share|improve this answer
























          • Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

            – Tony Vodicka
            Nov 23 '18 at 2:26











          • If you want to use HTML, you'll have to remove both.

            – ceejayoz
            Nov 23 '18 at 2:27











          • Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

            – Tony Vodicka
            Nov 23 '18 at 2:34













          • @TonyVodicka Just remove the two function calls. echo get_the_content();

            – ceejayoz
            Nov 23 '18 at 2:35














          0












          0








          0







          The wp_trim_words function you're using strips all HTML tags out.



          https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/formatting.php#L3359



          $text = wp_strip_all_tags( $text );


          (Even if it didn't, your use of the esc_html function after it would also break your HTML tags in the post.)






          share|improve this answer













          The wp_trim_words function you're using strips all HTML tags out.



          https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/formatting.php#L3359



          $text = wp_strip_all_tags( $text );


          (Even if it didn't, your use of the esc_html function after it would also break your HTML tags in the post.)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 2:13









          ceejayozceejayoz

          141k34217300




          141k34217300













          • Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

            – Tony Vodicka
            Nov 23 '18 at 2:26











          • If you want to use HTML, you'll have to remove both.

            – ceejayoz
            Nov 23 '18 at 2:27











          • Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

            – Tony Vodicka
            Nov 23 '18 at 2:34













          • @TonyVodicka Just remove the two function calls. echo get_the_content();

            – ceejayoz
            Nov 23 '18 at 2:35



















          • Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

            – Tony Vodicka
            Nov 23 '18 at 2:26











          • If you want to use HTML, you'll have to remove both.

            – ceejayoz
            Nov 23 '18 at 2:27











          • Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

            – Tony Vodicka
            Nov 23 '18 at 2:34













          • @TonyVodicka Just remove the two function calls. echo get_the_content();

            – ceejayoz
            Nov 23 '18 at 2:35

















          Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

          – Tony Vodicka
          Nov 23 '18 at 2:26





          Thank you for the feedback. Would you suggest I remove the wp_trim_words function or the esc_html function?

          – Tony Vodicka
          Nov 23 '18 at 2:26













          If you want to use HTML, you'll have to remove both.

          – ceejayoz
          Nov 23 '18 at 2:27





          If you want to use HTML, you'll have to remove both.

          – ceejayoz
          Nov 23 '18 at 2:27













          Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

          – Tony Vodicka
          Nov 23 '18 at 2:34







          Thanks, what would I replace this code with? --- echo esc_html( get_the_content(), 490 );

          – Tony Vodicka
          Nov 23 '18 at 2:34















          @TonyVodicka Just remove the two function calls. echo get_the_content();

          – ceejayoz
          Nov 23 '18 at 2:35





          @TonyVodicka Just remove the two function calls. echo get_the_content();

          – ceejayoz
          Nov 23 '18 at 2:35


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439708%2fwordpress-theme-is-not-allowing-html-in-my-content%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen