Answer the question
In order to leave comments, you need to log in
Wordpress theme and how to split post title?
I am writing a theme for wordpress and the question arose of how to make the post title divided into two parts if it consists of a date and a month.
Perhaps there is some function that will indicate the first word in the first paragraph, and the second word in the second.
Here is a block:
<?php
$args = array(
'numberposts' => 5,
'category' => 2,
'post_status' => 'publish',
);
$result = wp_get_recent_posts($args);
foreach( $result as $p ){
?>
<div class="item flex">
<div class="date flex">
<p id="day"><?php echo $p['post_title']; ?></p>
<p id="mounts"><?php echo $p['post_title']; ?></p>
</div>
<div class="details flex">
<p><?php echo $p['post_excerpt']; ?></p>
<a href="<?php echo get_permalink($p['ID']) ?>">
<p id="more">Детальніше <img src="<?php bloginfo( 'template_directory' ) ?>/image/arrow.png"></p>
</a>
</div>
</div>
<?php
}
?>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question