Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter arobson13

    (@arobson13)

    jnhghy, you are right, this is a grey area where if you do not know what you are doing, it can have a drastic impact on other pages in your site.

    However, since wordpress is a very intrusive CMS, it will be likely that any corrections you make to the core files may fix errors generated by the wordpress core files.

    If you make the edit manually, you will need to update wordpress manually, and make sure to include the edits/corrections you have implemented previously or “You’re gunna have a bad time”.

    Thread Starter arobson13

    (@arobson13)

    I edited the function wpautop() which is located in wp-includes/formatting.php. After some hacking away, I appended the following line of code (line 224):

    $allblocks = '(?:a|table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';

    As you can see, I added the a tag to the beginning of the string. This function, with the append, will add the p tags and remove them before returning the content string around the block tags listed in the $allblocks string. This will also add a new-line-feed in the source code for the a open and close tag.

    I am glad I was able to post the final fix. I hope this helps someone.

    Thread Starter arobson13

    (@arobson13)

    I guess I resolved the issue. I will have to edit the WordPress filters using the above link as a guide and remove the added <p> tag which causes the strange results.

    Here is an answer as to the effect that is happening:
    https://www.w3.org/TR/html5/syntax.html#syntax-tag-omission

    A p element’s end tag may be omitted if the p element is immediately followed by an address, article, aside, blockquote, dir, div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, menu, nav, ol, p, pre, section, table, or ul, element, or if there is no more content in the parent element and the parent element is not an a element.

    Thread Starter arobson13

    (@arobson13)

    Ok, so I broke it down to something completely weird. Has little to do with WordPress.

    Open up a new .HTML document and enter the following code:

    <a href="unique">hello<p></a>

    When you open it up and inspect element in Chrome or Firefox a duplicate link is created. Normally this would not be a problem since it doesn’t copy the anchor value and you can use CSS to hide the p tag for formatting.

    Here is the Inspection results for both browsers: https://imgur.com/bgZcs

    So my issue has to do with the creation of the <p> tag which was added for a reason I must figure out. Perhaps the link above will now be of some use.

    Thread Starter arobson13

    (@arobson13)

    Strange. I didn’t notice this earlier, but the code is different when I view the source and when I Inspect Element. This makes me think the links are being generated client side.

    ‘Inspect element’ in Chrome:

    <a href="link.com"><br>
    <img>
    <div><span></span></div>
    </a>
    <p><a href="link.com"></a>
    </p>

    ‘View Source’:

    <a href="link.com"><br />
    <img />
    <div><span></span></div>
    <p></a>

    I am going to go through the scripts running. I came across this article but it might not help. https://www.gkspk.com/view/programming/stop-wordpress-adding-p-tags-in-code-elements/

    Thread Starter arobson13

    (@arobson13)

    I don’t think this is being created by my theme. I have switched themes and the code is still duplicated.

    The first link is created by PHP, and is supposed to loop through creating a link for each animal. There is no where in my code where it would create the extra link. And as I said above if i remove the embedded <div></div> tags the second link does not generate.

    Thank you for your replies!

    Thread Starter arobson13

    (@arobson13)

    The following code is generated some how:

    <p>
    <a href="/mhs/wp-content/plugins/listgrid/petbio.php?id=666" rel="lightbox[Dog]" title="Test Dog" class="cboxElement"> </a>
    </p>

    I would like it all removed, not just hidden.

    Thread Starter arobson13

    (@arobson13)

    Still working away. I will update if I find anything.

    Google is being no help. This seems to be a very isolated incident, which makes me think there has to be something I am doing to cause WordPress to generate this extra code.

Viewing 8 replies - 1 through 8 (of 8 total)