简体   繁体   中英

Bootstrap auto generate <p> tag in Wordpress

Can anyone help me with this?, I use the_content() in my p tag and the bootstrap auto generate more p tag, and even the content did not placed inside the p . it is inside another p

picture-1:
在此处输入图像描述

picture-2:
在此处输入图像描述

Because the_content() will always wrap the content with a <p> tag.

You can use get_the_content() insted of the_content() but using get_the_content() will give you the content without any shortcodes or embedded media as mentioned at codex .

This is another solution to get exactly what you want:

<?php
$content = get_the_content();
$content = apply_filters('the_content', $content);
$replace = '<p class="discription">';
echo str_replace('<p>', $replace, $content ); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM