custom post type template

PHOTO EMBED

Tue Dec 20 2022 18:08:34 GMT+0000 (Coordinated Universal Time)

Saved by @deveseospace #undefined

<?php

if(is_page('home')) {

    $posts_per_page = 2;

} else {

    $posts_per_page = -1;

}

$query = array(

'post_type' => array('journal'),

'post_status' => array('publish'),

'orderby' => 'date',

'order' => 'DESC',

'posts_per_page' => $posts_per_page,

);

$q = new WP_Query($query); ?>

​

<div class="journals-wrap">

    <?php while ($q->have_posts()) : $q->the_post(); ?>

    <div class="journal-wrapper row">

        <div class="col-md-3">

            <p class="date-meta"><?php echo get_the_date(); ?></p>

            <h4 class="title">

                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

            </h4>

        </div>

        <div class="col-md-6">

            <p class="text"><?php echo strip_tags(substr(get_the_content(), 0, 0)); echo (strlen(strip_tags(get_the_content())) >= 300) ? ' ...' : ''; ?></p>

        </div>

        <div class="col-md-3">

            <a href="<?php the_permalink(); ?>" class="journal-btn">
30
                <svg width="38" height="27" viewBox="0 0 38 27" fill="none" xmlns="http://www.w3.org/2000/svg">

                <path d="M.4382 6.42613C37.67 5.63184 37.2204 4.79715 .4261 4.5618L23.4824 0.726611C22.6881 0.491264 21.85 0.944381 21.618 1.73868C21.3827 2.597 21.8358 3.36766 22.6301 3.60301L34.1357 7.01206L30.7266 18.5176C30.4913 19.3119 30.9444 20.1466 31.7387 20.382C32.5 20.6173 33.3677 20.1642 33.603 19.3699L37.4382 6.42613ZM1.71564 26.3183L36.7156 7.31828L35.2844 4.68172L0.284362 23.6817L1.71564 26.3183Z" fill="currentColor"/>
32
                </svg>
33
            </a>
34
        </div>
35
    </div>
36
    <?php endwhile; ?>
37
</div>
content_copyCOPY

https://eseospace.dev/websites/metahealthedu/wp-admin/theme-editor.php?file