• I am trying to post a very unsual thread regarding https://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.

    https://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 12 replies - 16 through 27 (of 27 total)
  • Thread Starter 4evrblu

    (@4evrblu)

    I have not yet heard from the author of the theme. So, as far as I am concerned, the topic remains unresolved. I have tweaked and played with the code and I am unable to get the matter resolved. Still could use some assistance ??

    Would anyone care to log into my site? Perhaps poke around a bit. Moderators ideally.

    Also, can the moderators change the title of this topic to something more appropriate? Such as PHP breaking down in individual pages, or something like that?

    Thanks

    Yes the code is a little buggy as it leaves an empty class in places but it does validate on https://validator.w3.org.

    Try validating the theme here: https://dev.webgazette.co.uk

    Ok I have emailed you and updated functions.php that should insert a class if one wasn’t previously set.

    This should fix the problem.

    Let me know if it works and I update the theme.

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

    to

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

    Thread Starter 4evrblu

    (@4evrblu)

    Ainslie, thank you. Actually, I did try <?php if (is_page()) { $highlight = "level1"; } else {$highlight = "current"; } ?> yesterday several times. Of course, with the working functions.php, it was doomed to fail. Let me check my mail and I will come back here and let you know is this addressed the issue.

    Thread Starter 4evrblu

    (@4evrblu)

    Hi Ainslie. I just installed your new funtions.php and I think we have made some progress. Here is what the current html outpout reads like:

    <div id="mainmenu">
    <ul class="level1">
    <li class="level1"><a href="https://totalphysiqueonline.com">Home</a></li>
    <li class='page_item' ><a href='https://totalphysiqueonline.com/about/' title='About'>About</a></li>
    <li class='current' ><a href='https://totalphysiqueonline.com/sponsors/' title='Sponsors'>Sponsors</a></li>
    <li class='page_item' ><a href='https://totalphysiqueonline.com/body-buddy/' title='Body Buddy'>Body Buddy</a></li>
    <li class='page_item' ><a href='https://totalphysiqueonline.com/spotlight/' title='Spotlight'>Spotlight</a></li>

    …etc

    Is that what you were looking for? If so, then the issue is resolved.

    However, I will admit that what I was expecting to see was this:

    <div id="mainmenu">
    <ul class="level1">
    <li class="level1"><a href="https://totalphysiqueonline.com">Home</a></li>
    <li class='level1' ><a href='https://totalphysiqueonline.com/about/' title='About'>About</a></li>
    <li class='current' ><a href='https://totalphysiqueonline.com/sponsors/' title='Sponsors'>Sponsors</a></li>
    <li class='level1' ><a href='https://totalphysiqueonline.com/body-buddy/' title='Body Buddy'>Body Buddy</a></li>
    <li class='level1' ><a href='https://totalphysiqueonline.com/spotlight/' title='Spotlight'>Spotlight</a></li>

    …etc

    Thanks for doing so much work to address this. Do you feel like the adjusted html output is what you are looking for?

    You will also notice that in the corrected adjusted output, the functions.php has created this:

    <li class='page_item' ><a instead of
    <li class=’page_item’><a

    In other words it has an extra space inserted between the last quote tick and the bracket for <li class=’page_item’ ><a

    That bit of code just sets a the variable “$highlight” for the link to home as it is manually inserted in the menu because the list pages function doesn’t add the home page link.

    The rest of the page menu is in the functions.php.

    You should now see that the classes are not empty and your validation should be ok?

    Thread Starter 4evrblu

    (@4evrblu)

    Hi.

    Yes the class is not empty now, and shows <li class=’page_item’ ><a

    but I was curious, so I backed up functions and went inside funtions.php and found this code around line 302 :

    $css_class = 'page_item';
    }
    echo "<li class='" . $css_class . "' ><a href='" . get_page_link($page_id) . "' title='" . wp_specialchars($title) . "'>" . $title . "</a></li>n";
    }

    as an experiment, I changed it to

    $css_class = 'level1';
    }
    echo "<li class='". $css_class ."'><a href='" . get_page_link($page_id) . "' title='" . wp_specialchars($title) . "'>" . $title . "</a></li>n";
    }

    I also reduced the extra space from ‘” . to ‘”. and this “‘ > to this “‘>

    Now the html output reads as follows:


    <ul class="level1">
    <li class="level1"><a href="https://totalphysiqueonline.com">Home</a></li>
    <li class='level1'><a href='https://totalphysiqueonline.com/about/' title='About'>About</a></li>
    <li class='current'><a href='https://totalphysiqueonline.com/sponsors/' title='Sponsors'>Sponsors</a></li>
    <li class='level1'><a href='https://totalphysiqueonline.com/body-buddy/' title='Body Buddy'>Body Buddy</a></li>
    <li class='level1'><a href='https://totalphysiqueonline.com/spotlight/' title='Spotlight'>Spotlight</a></li>
    <li class='level1'><a href='https://totalphysiqueonline.com/picturethis/' title='PictureThis'>PictureThis</a></li>

    etc…

    is this more of what we want and did I go about it the wrong way?

    The class used is totally irrelavant as there is no corresponidng style defined. It was just a value to output so that your site validated as you wanted. You can change it to whatever you prefer as long as it doesn’t clash with something in the css that is going to mess things up.

    Thread Starter 4evrblu

    (@4evrblu)

    Hi Ainslie.

    that is interesting, because I checked the CSS file a few days ago and level1 is declared in it. And here is what it is:

    #mainmenu ul.level1 {
    border-top: 1px solid #fff;
    border-bottom: 1px solid #fff;
    }

    So it seemed to me to be important. ??

    Also, what line of code in the functions.php file is causing the values to assume single verses double quotes?

    That is an <ul> tag with class “level1” and not a <li> tag with class “level1” and so has no effect. In other words the css is targeted at the <ul> only.

    Thread Starter 4evrblu

    (@4evrblu)

    OK ?? thank you.

    I would also like to know what line of code is forcing the single quotes. Sorry, but I would just like to know ??

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