V
V
Vyacheslav Borgomotov2016-04-25 00:23:23
WordPress
Vyacheslav Borgomotov, 2016-04-25 00:23:23

How to split post content output?

Good evening everyone. Help to implement:
The post is divided into parts.
1. Object (image, video, gif, etc.)
2. MORE tag
3. div - which contains the text of the post.
The conclusion is needed: On the left is the picture, and on the right is the text
Like this:

<style>
 .item-object { float: left; }
 .item-text { float: right; }
</style>
<div class="item-content">
  <div class="item-object">Объект (картинка видео итд)</div>
  <div class="item-text">Техт</div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kozlov, 2016-04-25
@v-borgomotov

In WordPress, by default, posts have the following fields and functions to display them:

<?php
echo get_the_title();//Вывести заголовок
echo apply_filters( 'the_content', get_the_content() );//форматированый вывод текстовой области. Т.е. вместе с тегами из редактора.
echo get_the_excerpt();//Вывод цитаты
echo get_post_meta( get_the_ID(), 'поле', true );//Вывод произвольного поля с именем 'поле'
$thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail-size', true );
echo $thumb_url[0];//Вывод url прикрипленной миниатюры размером thumbnail-size
echo get_permalink();//Вывод ссылки на пост
echo get_the_date( 'Y' );//Вывод даты(года).
?>

You can use them to get what you want. It is only necessary to consider a convenient form for filling posts and, accordingly, storing the value in which fields.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question