Support » Themes and Templates » ul interrupted comment php tag

  • Resolved Dusty


    I’m trying to figure out why my

      stops before the comment count. I’ve checked and checked each file that contains the following code and the
      definitely closes at the end of the list. Something must be interrupting it but I can’t see it. The inspect element says the ul is closing half-way through the list and the styling for the last two list items is wrong.

    The styling should put the items across the grey bar and look like the other text. Also that “> is no doubt part of the issue:

    Thanks in advance

Viewing 6 replies - 1 through 6 (of 6 total)
  • Dusty


    the unordered list is breaking. Somehow this didn’t print in my first post

    I believe the problem is lines 21 and 22:

    <li class="category">Posted in <a href="<?php the_category(); ?>"></a></li>
      <li class="comment-count"><a href="<?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>"</a></li>

    they producing this:

    <li class="category">Posted in <a href="<ul class="post-categories">
    <li><a href="" title="View all posts in The Epicurean" rel="category tag">The Epicurean</a></li></ul>"></a></li>
    			<li class="comment-count"><a href="<a href="" title="Comment on epic dish">No Comments</a>"</a></li>

    Both have the link incorrect, and shows no text. It should look more like this:
    <li class="category">Posted in <a href=" "><?php the_category(); ?></a></li>



    Yes, that fixed the unordered list from closing mid-way. It did mess up the styling for the category. If you have an idea why, let me know.
    Thanks for your help.



    Still need some help with this. Seems like the ul is still broken.
    Look at lines 28-33.

    If you inspect the element you can see it’s closing the ul after catgory listing.




    Forum Moderator

    as you are not using any parameters in for the_category() (line 30 of your pastebin) in your code, the following applies:

    (string) Text or character to display between each category link. The default is to place the links in an unordered list.

    i.e. you are getting another unordered list within your unordered list of post metadata.

    decide how you want the categories to show, and add the corresponding ‘separator’ parameter into the get_category() function.

    the use of the_category() in this line:

    <li class="category">Posted in <a href=" "><?php the_category(); ?></a></li>

    is actually wrong, as the_category() will output a link for each post category automatically;
    should be at least be corrected to (for example using a comma as separator):

    <li class="category">Posted in <?php the_category(', '); ?></li>

    re-consider what kind of output wou want in this section.



    Thanks. That explained things really well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘ul interrupted comment php tag’ is closed to new replies.