0

im working on a flip-card template and have a problem.

<div class="card" id="card-<?php the_ID(); ?>">  
    <div class="front"> 
    <div class="card-headline"><?php the_title( '', '' ); ?></div>

        <div class="card-text"><?php the_content(); ?></div>
        <div class="card-tags">
        <button class="btn btn-sm btn-link flip-btn">FLIP<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></button>
    </div>
    </div> 
    <div class="back">
        <div class="card-headline"><?php the_title( '', '' ); ?> (2)</div>

        <div class="card-text-back">Text</div>
        <div class="card-tags"><button class="btn btn-sm btn-link flip-btn">FLIP BACK<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></button></div>
    </div> 
</div>

i would like to place the teaser text before the more link on the front page, place a more link if there is more at the FLIP button and post the content after the more link on the second page. Is that possible? how ca i call the different parts?

i found some help in : Only show content before more tag

// Fetch post content
$content = get_post_field( 'post_content', get_the_ID() );

// Get content parts
$content_parts = get_extended( $content );

// Output part after <!--more--> tag
echo $content_parts['extended'];

but this gives my the content of the second part withoud functioning shortcodes. so it outputs [] for zotero for example

0

Found a solution which is working. Splitting the array like above just gives you the plain text so shortcodes wont work.

this works:

global $post;
$content = get_extended( $post->post_content ); //get the_content

$excerpt = $content['main']; //get the teaser part before more tag
$main_content = apply_filters('the_content', $content['extended']); //get part after more tag

echo $excerpt; //post teaser part
echo $main_content; //post main part

my head is smoking. too much for a beginner

and if you want to have

in your html use this:

echo wpautop( $main_content );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.