WordPress.org

Ready to get started?Download WordPress

Forums

Categories: extra <ul>, </ul> and <br /> tags (12 posts)

  1. StaceyUD
    Member
    Posted 7 years ago #

    For some reason, my sidebar code renders like this:
    <br />
    <h2>Categories</h2>

    <ul></ul>

    <ul>
    <li><a href="#" title="Cat 1">Cat 1 (28)</a></li>
    <li><a href="#" title="Cat 2">Cat 2 (17)</a></li>
    </ul>

    The trimming ul tag just under the title is causing invalid code and extra spacing that I need to get rid of. I've searched the forums for the past hour or so and couldn't find a thing related on this.

    this is my sidebar code:
    <br />
    <div id="sidebar"><br />
    <h2>Velkommen</h2><br />
    <?php include (TEMPLATEPATH . "/searchform.php"); ?><br />
    <?php wswwpx_fold_page_list('sort_column=menu_order&exclude=42'); ?><br />
    <?php<br />
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");<br />
    foreach ($link_cats as $link_cat) {<br />
    ?><br />
    <h2>L&aelig;s Artikler</h2>

    <ul><?php wswwpx_fold_category_list ('optioncount=1&hierarchical=1&hide_empty=0'); ?></ul>
    <?php } ?><br />
    <h2>Arkiv</h2>

    <ul><?php get_archives('monthly','10','custom','
    <li>','</li>
    '); ?></ul>
    </div><br />

    any suggestions would help, thank you.

  2. spencerp
    Member
    Posted 7 years ago #

    Have you manually added these tags to your theme's sidebar.php file? If so, with that catagories tag, I don't think you need to/ add any tags around it..? Someone please clarify this lol.. =P

    Also, why are you adding tags to it, couldn't you just "style" the "line heights" or "something", in your style.css file?

    spencerp

    God! I need to get back on the ball of theme editing.. I know there's nothing in the style.css file called: "something".... LOL! =P

  3. StaceyUD
    Member
    Posted 7 years ago #

    when I posted the above code it automatically put in the br tags, but everything else is correct.

    Some tags need ul's surrounding it, some don't - but this has nothing to do with that. For some reason an empty ul-tag followed by a break is being rendered with wordpress and if I remove the categories it doesn't show so it must have something to do with the categories and/or how the categories are called.

  4. whooami
    Member
    Posted 7 years ago #

    <?php wswwpx_fold_category_list is NOT a standard wp function. also the mysql code you have may or not be causing trouble.

    For starters you ought to do this.. apply those extra additions all by themselves to see EXACTLY what each is doing. Combining them like that and expecting all the nesting to work is a bad thing since you prolly dont know what they output.

    I like to do that kind of stuff in my footer, I know its there, and I can scroll to see it, and usually, especially at 6 in the am, no-one else will even scoll far enough to see it.

    Plugins always ought to be checked anyway to make sure they output valid code all by themselves before going live with them, and using them "along side" something else.

  5. spencerp
    Member
    Posted 7 years ago #

    when I posted the above code it automatically put in the br tags, but everything else is correct.

    [Slaps self]..Ah yes, I see now. ;) Sorry about that, my bad. I just woke up a little bit ago, be gentle.. =P

    Well, to me it looks like you're using a plugin of some sort, right? If so, have you tried contacting the plugin author?

    spencerp

    Thanks whooami! =)

  6. StaceyUD
    Member
    Posted 7 years ago #

    I've tried it with and without the plugin and even without out the same thing happens. (i went as far as disabling the plugin to double check)

  7. whooami
    Member
    Posted 7 years ago #

    that isnt what i said though, or asked. What does the plugin output? is THAT valid? What exactly is outputting invalid code?

    If its a combination of ALL of that, then you need to edit whats in between all of those extra bits.

    its worth noting that from your paste, it is absolutely impossible to tell whats going on, what is being generated by what, etc.. Im guessing that anyone that looks at that is apt to be nothing except confused.

  8. StaceyUD
    Member
    Posted 7 years ago #

    The output of the 'wswwpx_fold_category_list' tag is:
    <ul><li>cat1</li><li>cat2</li></ul>

    It makes no sense because it's after my h2 tag but before my ul tag:

    <h2>Categories</h2>(extra tags show here)<ul><?php wswwpx_fold_category_list ('optioncount=1&hierarchical=1&hide_empty=0'); ?></ul>

    but there's nothing there that can cause the extra tags.

    Perhaps theres another way to list the categories and the number of blogs in each categorie (ie. Blogs (16))

    I mean... i've taken out all code relating to the categories and the problem is fixed, but i need categories. I've removed the plugin I'm using, but it still happens... so It must be something to do with this code:

    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    ?>

  9. whooami
    Member
    Posted 7 years ago #

    The output of the wswwpx_fold_category_list tag is:

    <ul>
    <li>cat1</li>
    <li>cat2</li>
    </ul>
    It makes no sense because it's after my h2 tag but before my ul tag:"

    Um, it doesnt matter whats before it - it matters what it outputs. Whats before it is where you come in.

    fwiw, there is a standard wp function that lists categories, its wp_list_cats and it works just fine and outputs a valid nested list.

    what does :

    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    ?>

    output?

    --

    I see what you are saying aboout where the extra tags are located. your still not doing what I asked though.

    I want to see what they output seperately, NOT combined with header tags, and not together. :) and thats where YOU need to start. Look at what they do with nothing else there.

  10. StaceyUD
    Member
    Posted 7 years ago #

    I realize there is a standard wp function that lists categories. I am using a plugin for another purpose. To make things easier I'll just use the wp_list_cats from now on and to verify that it has nothing to do with the plugin I'm using.

    From the start:

    This is the code in my sidebar:
    <?php $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); foreach ($link_cats as $link_cat) { ?>
    <h2>Categories</h2>
    <ul><?php wp_list_cats('sort_column=name&optioncount=1'); ?></ul>
    <?php } ?>

    This is the output code:
    <h2>Categories</h2><ul></ul><ul><li><a href="#" title="Cat 1">Cat 1 (28)</a></li><li><a href="#" title="Cat 2">Cat 2 (6)</a></li></ul>

  11. StaceyUD
    Member
    Posted 7 years ago #

    took out the h2 tag, same output

    placed in the footer, away from everything else: same output.

  12. StaceyUD
    Member
    Posted 7 years ago #

    still don't know why this is happening...

Topic Closed

This topic has been closed to new replies.

About this Topic