How Can We Help?

Snippets

← All Topics

Add CSS Locks to Protected Post Titles

li.unlocked::before {
content: "\01F512";
padding-right: 10px;
}


Display posts in a grid with images instead of a list of titles

<?php
/**
 * Do not edit this file directly.  You can copy this file to your theme directory
 * in /your-theme/woocommerce-pay-per-post/shortcode-has_access.php
 * The $purchased variable is a WP Posts Object of purchased posts.
 */
?>
<style>
    .wc-ppp-purchased-container {
        display: flex; /* or inline-flex */
        flex-wrap: wrap;
    }
    .wc-ppp-purchased-item {
        flex: 1 1 150px;
        padding:10px;
        border:1px solid #ccc;
        margin:5px;
    }
</style>
<div class="wc-ppp-purchased-container">
  <?php if ( count( $purchased ) > 0 ) : ?>
      <?php foreach ( $purchased as $post ) : ?>
                <div class="wc-ppp-purchased-item">
                    <a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>">
                        <?php echo get_the_post_thumbnail($post->ID, 'medium'); ?>
                        <br>
                        <?php echo esc_html( $post->post_title ); ?>
                    </a>
                </div>
      <?php endforeach; ?>
  <?php else : ?>
        <p><?php apply_filters( 'wc_pay_per_post_shortcode_has_access_no_posts', esc_attr_x( 'You have not have access to any protected posts.', 'wc_pay_per_post' ) ); ?></p>
  <?php endif; ?>
</div>