• Hi, I want to remove comma between categories displayed on my home page http://thedripple.com below titles of post!

    I’m using the following code to display categories..

    <?php $parentscategory ="";
    foreach((get_the_category(' , ')) as $category) {
    if ($category->category_parent == 0) {
    $parentscategory .= ' <a class="cat-post-before" href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a>, ';
    }
    }
    echo substr($parentscategory,0,-2); ?>

Viewing 1 replies (of 1 total)
  • I do not see categories below the titles on your home page. Did you remove them?

    In your code above, the comma seems to be coming from near the end of this line, following the closing ‘/a’ tag:

    $parentscategory .= ' <a class="cat-post-before" href="' . get_category_link($category->cat_ID) . '" title="' . $category->name . '">' . $category->name . '</a>, ';
Viewing 1 replies (of 1 total)
  • The topic ‘Remove comma from wordpress categories!!!’ is closed to new replies.