locate code on blog post errors to correct validation
-
WP v3.7.4
using Blank custom theme
https://www.gracechurchhouston.comWorking on this site that is still under construction. I ran a validation check and corrected alot of errors but I am having trouble locating the html for the blog page posts so i can correct the code errors which is pretty much all the errors i have left so far:
What file is this code located in? (I have done a search in the forum but don’t see a clear answer)
Thanks.
-
The errors appear to be in the code that generates the post metadata section.
If your theme is a free one, post a link to its download site and you may be able to get more specific information. If it is a purchased theme, you should contact the theme author.
It is a blank custom theme created during a web design class last fall. We wrote the code and css and started with a basic WP theme but stripped out and replaced its code with ours using WP structure following lynda.com videos. Apparently i must have done something wrong re the blog posts metadata where all the errors show up – even though the posts themselves on the site are displaying okay right now. So not sure what’s going on or how to fix. Not many resources available to dive into the metadata corrections on my own. I see the line numbers on the validator corrections page but just don’t see where those lines appear (or which file) in the WP Editor. Thanks for your comments. I’ll continue to research. I appreciate your response.
The line numbers on the validator page refer to the HTML that is sent to the browser, not to the original source code files. You must view the source code and find the lines there.
In Firefox and , you view the source code by right-clicking in the screen and choosing ‘View Page Source’. In Internet Explorer, it is ‘View source’.
Thanks for that clarification on viewing actual source code. I used the shortcut for FF and can see how the line numbers match exactly with validator page.
The problem i’m having trying to correct the errors is the way WP is structured, it takes the html code and distributes it into different files accessed through the editor and i am looking through each file trying to locate the line with the error. Just not being very successful finding where the line error is situated in the various WP files. Possible files with blog post metadata are maybe Archives.php or meta.php or single.php, etc. but just don’t see a match to the way it appears in the validator and source code. Maybe i’m overlooking something. Would it help to post the code of these different files?
If you look at lines 79-83 of the source, you can see at least one of the problems:
<p class="postmetadata"> <small><em>Category: <a href="https://gracechurchhouston.com/category/righteousness/" title="View all posts in Righteousness" rel="category tag">Righteousness</a> <strong>|</strong> <a href="https://gracechurchhouston.com/2013/12/10/chosen/#respond" title="Comment on You Are Chosen by God">No Comments ?</a></p></em> </small>
The opening tags are in the order
<p>...<small><em>
and the closing tags are in the order</p></em></small>
, so the<p>
tag is out of order.See if you can find the file containing the text ‘postmetadata’. That should be the one with this problem.
ok.. thank you. yes… i see and understand those are errors in the source code. It says “class” is “postmetadata” but would that also be a file name? I will look for a similar file and go through the codes again. This is a list of all the files showing in the editor in WP (right side):
Templates
404 Template
(404.php)
Archives
(archive.php)
Comments
(comments.php)
Footer
(footer.php)
Theme Functions
(functions.php)
header-blog.php
Header
(header.php)
meta.php
nav.php
Main Index Template
(index.php)
Page Template
(page.php)
About Page Template
(pageabout.php)
Contact Page Template
(pagecontact.php)
Home Page Template
(pagehome.php)
Media Page Template
(pagemedia.php)
Media Players Page Template
(pageplayers.php)
Search Results
(search.php)
Search Form
(searchform.php)
Sidebar
(sidebar.php)
Single Post
(single.php)
Styles
Stylesheet
(style.css)
style-backup.css‘postmetadata’ is not a file name. It should be in the text of one or more of the files. Please put the meta.php file in a pastebin, and post a link to it here.
Sorry… I misread your reply. Some of the files in that above list (those that are not followed by a name in parenthesis) were created (possibly incorrectly) in our transition process and not originally in WP structure. The meta.php file looks like one of them and the code in it is so short I can just paste it here.
<div class=”meta”>
<small> Posted on: <?php the_time(‘F jS, Y’) ?>
by <?php the_author() ?></small>
</div>
I see the errors (<small> and – don’t see <p> tag) appear in that file and wondering if (being that short) it even affects the blog posts. Might be superfluous and perhaps should just be deleted. The posts are displaying properly and possibly controlled by another file? I just now located where all 3 “error” elements appear – it’s in single.php file – in this portion of the code in that file:
<p class=”postmetadata”>
<small>Category: <?php the_category(‘, ‘) ?> |
<?php comments_popup_link(‘No Comments ?’, ‘1 Comment ?’, ‘% Comments ?’); ?></p></small>So i guess i just need to move the em and small inside the close </p>
Right?When you post code in this forum, be sure to enclose it in backticks (usually to the left of the ‘1’ key). Please edit your reply and make that change.
I can’t see the closing
</em>
tag because the code was not enclosed in backticks, but I think you are on the right track.So sorry – i should have remembered the instructions… reposting:
Sorry… I misread your reply. Some of the files in that above list (those that are not followed by a name in parenthesis) were created (possibly incorrectly) in our transition process and not originally in WP structure. The meta.php file looks like one of them and the code in it is so short I can just paste it here.
<div class="meta"> <small> Posted on: <?php the_time('F jS, Y') ?> by <?php the_author() ?></small> </div>
I see the errors (
<small> and - don't see <p> tag
) appear in that file and wondering if (being that short) it even affects the blog posts. Might be superfluous and perhaps should just be deleted. The posts are displaying properly and possibly controlled by another file? I just now located where all 3 “error” elements appear – it’s in single.php file – in this portion of the code in that file:<p class="postmetadata"> <small>Category: <?php the_category(', ') ?> | <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?></p></small>
So i guess i just need to move the em and small inside the close </p>
Right?Yes, that is correct. But, I suspect that the error is also in other files, particularly those that are designated some sort of Template. You should search every file for ‘postmetadata’.
yes.. ok – i will do that and search for that code in other files.
The meta.php small file looks like it may have been one we added (doesn’t have a WP name in parenthesis under it) and doesn’t have a <p> tag in it… not sure what or if it’s controlling anything so i guess i’ll just leave it for now until other errors or corrected and then consider deleting it.
Thanks for your help. I’ll post again to mark resolve if the errors i correct are cleared in the validator.
I looked through all files and only found the problem in that one file (single.php) so corrected the error. This took it down from 20 errors to only 3 – all the same – an extra <p> tag in only 3 of the 5 posts… apparently doesn’t affect them all. I can clearly see in the validator the tag i need to remove but again can’t locate it in the WP file structure. Not sure if you have any thoughts on that from your vantage point?
https://validator.w3.org/check?
uri=http%3A%2F%2Fgracechurchhouston.com%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2FservicesYou have been a great help! Thank you.
The three errors left are coming from your entries under Good News in the right sidebar. You have two opening
<p>
tags just before the text of each section, and two closing</p>
tags following the text. You need to remove the outermost tags so that you do not have nested<p>
tags.Yes… i do see clearly where in the source code the errors occur and what i need to do to correct them. My problem is locating which file in the WP structure contains those 3 specific errors since the line numbers don’t correspond. I’m not seeing where the specific post is found in the php files in the Editor. I’ve looked through each file and also in the post page itself but do not see the <p> tags. Is there a way to find the line in the code within WP files?
Thank you.
- The topic ‘locate code on blog post errors to correct validation’ is closed to new replies.