• Resolved aptdesignonline

    (@aptdesignonline)


    Hi,

    I’m using some standard PHP to output the Category List below each post title.

    I’ve tried two different lines of code to output this:
    <span class="cat-links">Category:<?php printf(get_the_category_list(',') ) ?></span>
    and
    <span class="cat-links">Category:<?php the_category(', '); ?></span>

    However, when a post is in two categories, both codes output an extra space before the comma that separates the categories. So it looks like this:

    This post is in: Category 1 , Category 2

    Could someone tell me what they think might be going on? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anne Dorko

    (@annedorko)

    Link?

    Thread Starter aptdesignonline

    (@aptdesignonline)

    Ah, the site is http://www.kaykenyon.com

    Thanks

    Michael

    (@alchymyth)

    this extra space comes from the style.css:

    span.cat-links, span.cat-links a {
    	color: #492d00;
    	background-color: #e2dbcd;
    	margin-right: 5px;
    	padding: 3px 2px 1px 7px;
    }

    from ‘margin-right:5px;’ and the second value in ‘padding: 3px 2px 1px 7px;’

    set the 5px to 0px and 2px to 0px to remove all the space.

    Thread Starter aptdesignonline

    (@aptdesignonline)

    Alchymyth, you were totally right (much to my embarrassment). I needed to split out those two spans and style them differently. Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Extra Space in Category List’ is closed to new replies.