Support » Fixing WordPress » Why am I seeing <!– and –> in my category names?

  • I have tried to approach this a few different ways but have not found a solution.

    In order to display artists’ full names but in alphabetical order by last name I added <!--lastname--> to each category in phpmyadmin (since the WP category management page wouldn’t save the commented out portions) and it used to work great. But with the recent upgrade it stopped working as you can see:

    To make things weirder on the individual artwork pages it displays the categories (i.e. the artist names) correctly: If you look at the code there you’ll see the <!--lastname--> is in there, hidden away nicely.

    What’s going on? Why are these commented out segments showing up? What can I do to fix it?

    I can imagine three solutions:
    1) Fixing my wp_list_cats code in some way that I can’t think of.
    2) Convincing WordPress to not turn the <!-- --> characters into viewable charcters.
    3) Hack something to allow the categories to sort by slug or nicename bypassing the need for this hack in the first place. (By the way, orderby=nicename should really be an option)


Viewing 7 replies - 1 through 7 (of 7 total)
  • By the way, this is how I call the list:

    <?php if (is_category()) { $posts = query_posts($query_string . "&orderby=post_name&order=asc&use_desc_for_title=1"); } ?>
    <ul class="gallerybox"><?php wp_list_categories('child_of=2&use_desc_for_title=1&orderby=name&title_li='); ?></ul>

    And this is from the individual artwork page (which works correctly)
    <?php the_category(”) ?>

    Check your theme files and make sure that you don’t have <!– –> inside of <!– –> that’s been a problem for me in the past.

    I just viewed the source code from my browser and this is what I see: <!–

    < ?php $my_query = new WP_Query(‘category_name=featured&showposts=1’);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>

    “><img src=”http://editedout/22-thumb.jpg” alt=”<!–roberts–>editedout” />< ?php endwhile;?>–>

    PROBLEM: alt=”<!–editedout… Solution remove the <!– –> from the image alt.

    Sorry, that was commented out because it was from an earlier version that I don’t use anymore. I removed the junk. Problem is still there. It’s only the cat titles that should have <!– –> and only for the invisible lastnames that force alpha order. But WP is turning those characters into <!& #8211; & #8211;> and therefore forcing them — and the names they are hiding — to be displayed.

    EDIT: Also could you edit out the references to the site and the artist? I don’t want this thread to show up in google searches. Thanks. 🙂

    Is you main gallery page a page or a post?

    It’s actually a category. I have a big if then statement pulling different category templates depending on if it’s the main gallery category, individual artist categories, or events categories. The individual artworks and events are posts.

    Haven’t solved this particular problem but a plugin someone told me about here solved it another way:

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Why am I seeing <!– and –> in my category names?’ is closed to new replies.