• I am trying to post a very unsual thread regarding http://totalphysiqueonline.com/ and trouble I am having validating the individual pages. When I try to paste the code, it screw up the topic and the topic gets closed or the rss feed to the topic becomes invalid.

    http://totalphysiqueonline.com/ is not validating the individual pages, and I need someone to go there and use the validation tool at the top right within the meta section to see what I am talking about. The splash page validates just fine. But when you link to any of the seven pages I created, via the buttons up top, the code that controls them which utilizes li class=”level1″ and li class=”current” breaks down horribly.

    The php code that controls is in the header, of course. It seems to be valid code, and obviously works to create the header and its buttons, and even validates the splash page, but there is something amiss that is breaking the code once you link to the pages, causing the UL and LI tags to loose values between the class= ‘tags’ so that class=” tag values shows up empty. Does that make sense?

    I am sorry for the poorly constructed topic, but clearly I need some coaching as to how to paste code for people to look at.

    And what the heck is a backtick? Is that geek-speek for a backward slash?

Viewing 15 replies - 1 through 15 (of 27 total)
  • Thread Starter 4evrblu

    (@4evrblu)

    OK I search for backtick and I found out what the hell they are. No wonder I didn’t know what they were. I have never, ever used it. Turns out that other people in WP are in the dark as well.

    I will try to post the code using the back tick

    <?php if (is_page()) { $highlight = ""; } else {$highlight = "current"; } ?>
    <div id="mainmenu">
    <ul class="level1">
    <li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas09'); ?></a></li>
    <?php
    if(function_exists("wp_andreas09_nav")) {
    wp_andreas09_nav("sort_column=menu_order&list_tag=0&show_all_parents=1&show_root=1");
    }
    ?>
    </div>

    Thread Starter 4evrblu

    (@4evrblu)

    OK that worked.

    WHEW

    Finally.

    The code I pasted is from the header.php file.

    As an aside, if you make a post and it doesn’t show up, don’t try posting it 12 more times.

    Instead, just wait and allow a moderator to remove it from the spam traps.

    Thanks.

    {refer to http://wordpress.org/support/topic/97707?replies=1}

    If you want to post long(er) code – always use http://wordpress.pastebin.ca and post back the URI.

    Thread Starter 4evrblu

    (@4evrblu)

    Handy I am sorry, thank you. I appreciate it. Sorry for the successive posts.

    Does anyone have a solution to the aboove issue by any chance?

    First:

    http://validator.w3.org/check?uri=http%3A%2F%2Ftotalphysiqueonline.com%2Fsponsors%2F

    seems to have no problem with your Pages.

    The error you’re getting from the other validator is due to a stricter interpretation of the attribute=value construct in a tag, in that the value should not be empty (or to use their semantics, its min(imum)Length cannot be less than 1).

    To avoid it, you can always change your code to:

    <?php if (is_page()) { $highlight = "is_page"; } else {$highlight = "current"; } ?>

    I’m not 100% certain, but I do believe a class does not actually need to be declared in your css to be considered ‘valid.’

    Thread Starter 4evrblu

    (@4evrblu)

    Well, if anyone has a suggestion please chime in. Otherwise if I find the solution myself I will let you know.

    Ahem…

    Really, the only validator one should worry about is http://validator.w3.org/&#8230;.

    Thread Starter 4evrblu

    (@4evrblu)

    OK thanks guys, lemme try this…

    Thread Starter 4evrblu

    (@4evrblu)

    That does not fix the issue. Hmmm.

    The html output of the code above is more or less identical to the previous one:

    <div id="mainmenu">
    <ul class="level1">
    <li class="is_page"><a href="http://totalphysiqueonline.com">Home</a></li>
    <li class=' current' ><a href='http://totalphysiqueonline.com/about/' title='About'>About</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/sponsors/' title='Sponsors'>Sponsors</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/body-buddy/' title='Body Buddy'>Body Buddy</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/spotlight/' title='Spotlight'>Spotlight</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/photographic-phun/' title='PictureThis'>PictureThis</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/contact/' title='Contact'>Contact</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/disclaimer/' title='Disclaimer'>Disclaimer</a></li>
    </ul></div>

    It’s the oddest thing. Two things are happening:

    1) the values should be li class=”level1″ unless its the current page. Instead the values are being changed to li class=” which reveals the other oddity:
    2) the double quotes are being replaced with single quotes and extra spaces are being added for li class=’ current’

    What the heck is causing that?

    I would still like to point out that the splash home page uses the same php call tags and it works, yeilding the following html::

    <div id="mainmenu">
    <ul class="level1">
    <li class="current"><a href="http://totalphysiqueonline.com">Home</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/about/' title='About'>About</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/sponsors/' title='Sponsors'>Sponsors</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/body-buddy/' title='Body Buddy'>Body Buddy</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/spotlight/' title='Spotlight'>Spotlight</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/photographic-phun/' title='PictureThis'>PictureThis</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/contact/' title='Contact'>Contact</a></li>
    <li class='level1'><a href='http://totalphysiqueonline.com/disclaimer/' title='Disclaimer'>Disclaimer</a></li>
    </ul></div>

    Thread Starter 4evrblu

    (@4evrblu)

    For the record I think the stricter interpretation makes better sense in this particular instance.

    And Kafka, the css does contain a style called level1. Its declared. And its there for a reason.

    I think the issue is here:
    <?php if (is_page()) { $highlight = ""; } else {$highlight = "current"; } ?>

    It should be :

    <?php if (is_page()) { $highlight = "level1"; } else {$highlight = "current"; } ?> Shouldn’t it?

    But even what I change it to that, the class= does not assume the value of highlight = “level1”, and instead morphs to empty once a page link is clicked.

    1. No limit I’m aware of. All the urls in it triggered Akismet (spam tool). I’ve de-spammed your post.

    2. Whatever interpretation (and validation tool) you go with is your choice.

    3. Using ‘level1’ as a class (for both the ul and li tags), or something different, is again up to you. I was merely pointing out the empty value for $highlight (and so the class attribute) was the cause of the error.

    4. I see this on your Pages at present:

    <li class="is_page"><a href="http://totalphysiqueonline.com">Home</a></li>
    <li class='' ><a href='http://totalphysiqueonline.com/about/' title='About'>About</a></li>

    The class value for the About Page (as well as the others) is also a problem, and this is apparently generated by wp_andreas09_nav() (a function from the theme?).

    5. Please, call me Kaf.

    Thread Starter 4evrblu

    (@4evrblu)

    Hi Kaf, yeah I think it’s clearly a them issue. Here is the function you are referencing:

    <?php
    if(function_exists("wp_andreas09_nav")) {
    wp_andreas09_nav("sort_column=menu_order&list_tag=0&show_all_parents=1&show_root=1");
    }
    ?>

    I believe this is for pages that have sub pages? Not sure.

    As you can see by the html output, for some reason the php does not break down at the splash page level. It begins to be wonky at the moment a page gets clicked. Andreas06 (a theme I have but do not use) uses a very similar php call. It looks like this:

    <?php
    if (is_page()) { $highlight = "page_item"; } else { $highlight = "page_item current_page_item"; } ?>
    <div id="nav">
    <ul>
    <li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas06'); ?></a></li>
    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=' ); ?>
    </ul>
    </div>

    You will notice that { $highlight = “page_item”; } is coded using a value for highlight. This php works in that theme. I tried it and all the pages work and the html output does not break down as it does with andreas09.

    Man I am sorry to be bugging you guys with this, but I am very grateful for the help!

    Thread Starter 4evrblu

    (@4evrblu)

    Anyway, I know where the issue is showing up. I know what code to be looking at. What I do not understand is why it is happening and how to fix it.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Please help; WP forums giving me trouble’ is closed to new replies.