Skip to content

Add support for "latest news" view only one post without padding #1

@orrpan

Description

@orrpan

Awesome plugin!
For now I'm using this, to see if there only is one post showing then it should only present the title in regular font (as for a first page "This is the latest news"). Would be awesome if this could be implemented some better solution for this!

The perfect solution would get the text in plaintext and no extra things

cision-block/templates/cision-block.php

?>

<section<?php echo $wrapper_attributes; ?>>
<?php echo $prefix; ?>
<?php if (count($cision_feed)) : ?>
    <?php foreach ($cision_feed as $item) : ?>
       <?php if (count($cision_feed) === 1) : ?>
            <p>
                <time><?php echo date($options['date_format'], $item->PublishDate); ?></time><br>
                <?php echo esc_html($item->Title); ?>
            </p>
        <?php else : ?>
        <article<?php echo $attributes; ?>>
            <h2><?php echo esc_html($item->Title); ?></h2>
            <time><?php echo date($options['date_format'], $item->PublishDate); ?></time>
            <p>
            <?php if (isset($item->Images[0])) : ?>
            <span class="cision-feed-item-media">
            <img
                    src="<?php echo esc_url($item->Images[0]->DownloadUrl); ?>"
                    alt="<?php echo esc_html($item->Images[0]->Description); ?>"
            />
            </span>
            <?php endif; ?>
            <?php print wp_trim_words(esc_html($item->Intro ? $item->Intro : $item->Body)); ?>
            </p>
            <?php if (isset($item->CisionWireUrl, $readmore)) : ?>
            <a
                    href="<?php echo esc_url($item->CisionWireUrl); ?>"
                    target="<?php echo $item->LinkTarget; ?>"
            ><?php _e($readmore, CISION_BLOCK_TEXTDOMAIN); ?></a>
            <?php endif; ?>
        <?php endif; ?>
    </article>
    <?php endforeach; ?>
<?php endif; ?>
<?php echo $pager; ?>
<?php echo $suffix; ?>
</section>

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions