Extract, the _ exist (); add to the editorial interface of Wordpress pages

Extract, the _ exist (); add to the editorial interface of Wordpress pages

There may be many situations where a "post _ title" and "post _ content" would be good for a additional field for both admin and template frontend. The simple snippet that fits into function s.php will immediately make this field available to us.

// Kivonat támogatás hozzáadása az aktív sablon oldalaihoz by berelhetoweboldal.hu
function netroponthu_add_excerpt_to_pages() {
	add_post_type_support( 'page', 'excerpt' ); 
}
add_action( 'init', 'netroponthu_add_excerpt_to_pages' );

If you did everything right, then in the usual Wordpress sidebar, the entry in the ear between the highlighted image and the conversation appeared the immediately usable extract field.

How can I use it in the template?

There are many ways to write it, and this is within a Wordpress loop, where we cut the content to a maximum of 40 words in length.

<?php 
// Az excerpt változóba lekérjük a mező tartalmát by berelhetoweboldal.hu
$excerpt = get_the_excerpt();
 
// Igény esetén tetszőleges hosszúságúra, a példánkban maximum 40 szavasra vágjuk.
$trimmed_excerpt = wp_trim_words( $excerpt, 40, '...' ); 

// Kiírjuk a levágott kivonatot és három pontot helyezünk el a szövegünk végére.
echo $trimmed_excerpt; 
?>

There's a Wordpress outside of the loop.

<?php 
// Meghatározzuk az $oldalID változóba annak az oldalnak az azonosítóját, melynek a kivonatát leakarjuk kérni by berelhetoweboldal.hu
$oldalID = 0;

// Az excerpt változóba lekérjük a mező tartalmát az előzőleg definiált oldalból
$excerpt = get_post_field( 'post_excerpt', $oldalID ); 

// Kiírjuk a kivonatot
echo $excerpt; 
?>

Are you stuck? Can we help you?

If all this is "Chinese" to you or you don't want to deal with anything like this, you can subscribe to our rental website, where you can use the options offered by the extract field in every template.

Get a ticket to NETRO! Netro
Side bar

Similar entries

Online marketing tips, tricks and integration...

Plan your digital presence consciously!

All Articles

Start your own rented website today!

Fill out the form so the whole world can get to know your idea!

    Contact information

    Required service

    Paying on departure

    19.900 HUF + VAT total fee

    Paying on departure

    35.820 HUF + VAT total fee

    Paying on departure

    49.900 HUF + VAT total fee

    Paying on departure

    89.820 HUF + VAT total fee

    Paying on departure

    49.900 HUF + VAT total fee

    Paying on departure

    89.820 HUF + VAT total fee

    Paying on departure

    HUF 99.900 + VAT total fee

    Paying on departure

    179.820 HUF + VAT total fee

    Billing information

    captcha

    Can we help you?

    If you have any further questions, feel free to contact us..

    Telephone

    +36 20 237 7495
    +36 99 789 758

    Email

    info @ netro.hu
    _

    Office

    On Munsofas 08: 00 - 16: 00
    9400 Sopron, Holy Ghost 1st fst. 2.

    Web

    berelwetoweb. hu
    netro.hu

    Pin It on Pinterest

    Share This