Site logo

Archived topic

Styling Related Custom Posts

5 replies · Started by Dee on May 10, 2019

Viewing posts 1–6 of 6

I created a related custom post using WP Show Posts and an element hook.
I need to know how to style the output.
I am using the Dispatch site as a basis, and would like to apply the following classes (wpsp-card, zero-padding, no-background) similar to the standard sidebar from dispatch.

I created a list based on my custom post type and taxomony in WP SHow Posts.
I then created a related event query using a, Element hook which displays the WPSP list just above the right sidebar.

Where do I reference/apply the classes I want to style the related sidebar posts? DO I need to create a shortcut to apply them?

Here is my coding from the Related-Event Element:

<?php
if ( is_singular('event') ) {
$cats = get_the_terms($post->ID, 'event_category');
$cat = $cats[0];
} else {
$cat = get_the_terms( $post->ID, 'event_category', get_query_var( 'event_category' ) );
}

$cat_slug = $cat->slug;
$list = get_page_by_title( 'eventrelated', 'OBJECT', 'wp_show_posts' );
wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );

?>

Thanks for your help.

Hi there,

If you're using the latest beta of WP Show Posts Pro, there's a custom class field you can add classes to in the More Settings tab.

Let me know :)

OK, you can have my money. I am upgrading to pro.

Ah sorry - I assumed you had pro. There are likely ways to do it without pro if you'd prefer :)

That is OK, I like to keep the paid options as few as possible, so not to nickle and dime myself to death.
There are a number of other things I was looking at as well. The pro version simplifies things for me so I can move on to other areas of the website.

I saw a post on how to use custom archive pages and use your plugin to display the posts.

Will I need to create a separate page for EVERY category, or can I for some, and the others default to the standard archive page?

It's not easy to replace default archives with WPSP at the moment, unfortunately.

You could tweak the theme templates to use a WPSP list in the archive.php file, but we haven't tested it much yet, so we don't have solid instructions on how to do it.

This archived topic is closed to new replies.