H
H
HelloWJS2021-06-29 06:59:37
WordPress
HelloWJS, 2021-06-29 06:59:37

How to make a custom post output?

I need to display the title, text (if any), picture (if any), and other characteristics of the post from the post (standard) INTO THE MAIN page with ready-made html and css styled code.
60da996e5c0cc036891090.png

<div class="p-2 flex-fill  everyBlock animate_size" style="background: linear-gradient(360deg, rgba(21, 63, 94, 0.54) 10.75%, rgba(21, 63, 94, 0) 38.38%), url(/img/main/fb-firstImg.png);flex-grow: 0 !important;">
          
            <div class="d-grid gap-2 d-md-block">
                <button class="btn btn-primary fb__myBtn" type="button">название категории</button>
            </div>
            <a href="./innerPage.html" class="common-a">
            <div class="fb__innerText">
                <p class="fb__parag"><img src="./img/main/fb-clock.svg" alt="" class="th_s__leftImg">3 июня, 2021</p>
                <h2 class="fb__h2">H2 Завлекающее, Попадающие в Трафик Название Новости</h2>
            </div>
            </a>
        </div>

that is, on the MAIN page, display data from the post, inside tags, inside links, inside the title, inside the picture, insert data from the post.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima, 2021-06-29
@HelloWJS

<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );  ?>" alt="<?php echo get_post_meta( get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true);?>">

get_the_ID() is the id of your post

D
Dmitry Kuznetsov, 2021-06-29
@dima9595

Read the documentation about templating in Wordpress.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question