Why am I seeing <!-- and --> in my category names? (8 posts)

  1. buskerdog
    Posted 9 years ago #

    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: http://tinyurl.com/ynjhgu

    To make things weirder on the individual artwork pages it displays the categories (i.e. the artist names) correctly: http://tinyurl.com/2b9tyz 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)


  2. buskerdog
    Posted 9 years ago #

    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('') ?>

  3. cartpauj
    Posted 9 years ago #

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

  4. cartpauj
    Posted 9 years ago #

    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.

  5. buskerdog
    Posted 9 years ago #

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

  6. cartpauj
    Posted 9 years ago #

    Is you main gallery page a page or a post?

  7. buskerdog
    Posted 9 years ago #

    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.

  8. buskerdog
    Posted 9 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic