Support » Theme: Hueman » How to style custom post type

  • Hello Alexander,

    Firstly, I’d like to thank you for this amazing free theme.

    My question is – I’ve added a custom post type in my WordPress installation, in its category page all posts show up with 100% width (screenshot). I’d like to have those posts in the same grid view as the default category archive. How do I fix this?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Glad you like it!

    If you check the index.php file, you will see that the content loop is wrapped in:

    <div class="post-list group">
    <?php $i = 1; echo '<div class="post-row">'; while ( have_posts() ): the_post(); ?>
    <?php get_template_part('content'); ?>
    <?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>

    Try adding that around your custom post type archive loop as well.

    Actually I did try that, but still doesn’t work.

    I have created the post type following instructions in the Codex. Also, I am showing articles listed in that post type on the homepage using below code:

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( is_home() && $query->is_main_query() || is_category())
    		$query->set( 'post_type', array( 'post', 'page', 'rhyme' ) );
    	return $query;

    Everywhere the posts listed in ‘rhyme’ appear the same as seen in the previous screenshot.

    I added this line to CSS because I had the same (or a similar) problem:

    .post-list .post,
    .post-list .project,
    .post-list .page { width: 50%; float: left; }

    PROJECT is the name of my custom post type

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to style custom post type’ is closed to new replies.