WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] ul interrupted comment php tag (7 posts)

  1. Dusty
    Member
    Posted 2 years ago #

    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.

      http://pastebin.com/GtkPSq4r

      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:
      http://www.maxlovesmuse.com/category/the-epicurean/

      Thanks in advance

  2. Dusty
    Member
    Posted 2 years ago #

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

  3. csleh
    Member
    Posted 2 years ago #

    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="http://www.maxlovesmuse.com/category/the-epicurean/" 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="http://www.maxlovesmuse.com/2011/09/12/epic-dish/#respond" 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>

  4. Dusty
    Member
    Posted 2 years ago #

    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.

  5. Dusty
    Member
    Posted 2 years ago #

    Still need some help with this. Seems like the ul is still broken.
    Look at lines 28-33.
    http://pastebin.com/F90UaGmi

    If you inspect the element you can see it's closing the ul after catgory listing.
    http://www.maxlovesmuse.com/category/brooklyn/

    thanks

  6. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Function_Reference/the_category

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

    separator
    (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.

    ps:
    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.

  7. Dusty
    Member
    Posted 2 years ago #

    Thanks. That explained things really well.

Topic Closed

This topic has been closed to new replies.

About this Topic