Ecommerce Shopify WordPress Discussion

WordPress: Display posts based off specific class

I'm sure there is a simple solution to this and that I'm over thinking it, but... I have created a "favourites" button that when clicked, it adds a class ("post-liked") to the post. I've been trying to figure out a way to only display posts that have this class on a separate custom page, but not having any luck finding a solution that displays them. Any ideas how I can go about this? I've shared a simple version of how I have my post list setup below. Thanks in advance! Custom Post Page <?php /**************************************************************** * * Name: "Favourites" Page Template * Template Name: Theme Template: Favourites * Template Post Type: Page * Author: NAME * Author URI: https://.... * Description: Displays posts from 'favourites' button. * ****************************************************************/ get_header( '' ); ?> <section id="page-favourites" class="myclasses"> <div class="myclasses"> <h1>Favourites</h1> </div> <div class="myclasses"> <div id="archived-favourites" class="myclasses"> <?php get_template_part( 'inc/templates/content/archive', 'favourites' ); ?> </div> </div> </section> <?php get_footer( '' ); ?> Post Structure <?php if ( have_posts() ) : ?> <ul id="archived-posts" class="myclasses"> <?php while ( have_posts() ) : the_post(); ?> <li id="post-id-#" class="myclasses post-liked"> <button class="post-like-button"></button> </li> <?php endwhile; ?> </ul> <?php else: endif; ?>
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.