如何在不使用<-more->的情况下将wordpress the_content分为3列

时间:2018-07-26 06:21:40

标签: php html wordpress

我想通过wordcount而不是按字母数将Wordpress Bydefault内容分为3列。确切的代码是什么。这是我的代码html ---

<p>Chandigarh and its surrounding provinces were hit by rain early morning. The Punjab and Haryana authorities were kept on a high alert due to the storm advisory sent by the Met department. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls. These are likely to affect many regions of the country including Delhi, till Friday. This is quite prevalent as the mountains of Himachal Pradesh received an unsmoked snowfall. </p>
<p>On Monday the weather warning bulletin, India Meteorological Department said that some states including Bihar, Uttar Pradesh, West Bengal, Odisha, Karnataka, Kerala, and Sikkim are more likely to be a prey to gusty winds and thunderstorm. The weather officer recorded his statements that say “Thunderstorms and squalls are “very, very likely at isolated places in Haryana, Chandigarh, and Delhi”. The weather bulletin displayed warning due to the heat wave conditions in the two pockets in Vidarbha, Maharashtra. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls. </p>

<section>
    <div class="row">
        <div class="col-md-5">
            <div class="left">
                <h4 class="heading4">Highlights:</h4>
                <ul class="ul-highlights">
                    <?php while( have_rows('high_lights') ): the_row();?>
                        <li><?php the_sub_field('highlight');?></li><?php endwhile;?>
                </ul>
            </div>
        </div>
        <div class="col-md-7">
            <div class="right">
                <p>Chandigarh and its surrounding provinces were hit by rain early morning. The Punjab and Haryana authorities were kept on a high alert due to the storm advisory sent by the Met department. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls. These are likely to affect many regions of the country including Delhi, till Friday. This is quite prevalent as the mountains of Himachal Pradesh received an unsmoked snowfall. </p>
                <p>On Monday the weather warning bulletin, India Meteorological Department said that some states including Bihar, Uttar Pradesh, West Bengal, Odisha, Karnataka, Kerala, and Sikkim are more likely to be a prey to gusty winds and thunderstorm. The weather officer recorded his statements that say “Thunderstorms and squalls are “very, very likely at isolated places in Haryana, Chandigarh, and Delhi”. The weather bulletin displayed warning due to the heat wave conditions in the two pockets in Vidarbha, Maharashtra. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls.</p>
            </div>
        </div>
    </div>
</section>

<p>Chandigarh and its surrounding provinces were hit by rain early morning. The Punjab and Haryana authorities were kept on a high alert due to the storm advisory sent by the Met department. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls. These are likely to affect many regions of the country including Delhi, till Friday. This is quite prevalent as the mountains of Himachal Pradesh received an unsmoked snowfall. </p>
<p>On Monday the weather warning bulletin, India Meteorological Department said that some states including Bihar, Uttar Pradesh, West Bengal, Odisha, Karnataka, Kerala, and Sikkim are more likely to be a prey to gusty winds and thunderstorm. The weather officer recorded his statements that say “Thunderstorms and squalls are “very, very likely at isolated places in Haryana, Chandigarh, and Delhi”. The weather bulletin displayed warning due to the heat wave conditions in the two pockets in Vidarbha, Maharashtra. The weather bureau in Delhi has been informed of the thunderstorms, gusty winds, and squalls.</p>

1 个答案:

答案 0 :(得分:0)

<?php 
$word = "Hello this a sample content";
$word_count = str_word_count($word);

$breakpoint=$word_count /3;

$substring1 = substr($word,0,$breakpoint);
$substring2 = substr($word,$breakpoint,$breakpoint*2);
$substring3 = substr($word,$breakpoint*2); 
?>

现在您将在3个不同的位置打印3个子字符串。