• I am trying to “destyle” H1 – H6 tags in order to use them in my content a different way, but something buried in WP is automatically inserting a line break both before and after the tag, thwarting my efforts.

    I am not using the visual editor, but I searched through tinyMCE config anyway and couldn’t find it (settings for force line breaks are set to false).

    I suspect it is somewhere else in the includes files (default-filters.php or rewrite.php perhaps?) but still can’t find it.

    I’m not a coder by any stretch, but I can read and understand much of it, and can make minor modifications if someone can tell me where to find this and remove it.

    Ideally I’d like a solution that would exist in my own (theme’s) functions.php (using a remove_action) so I don’t have to re-fix this with each upgrade.

    Can anyone please help me find where WP is rewriting Hx tags and remove this?

Viewing 10 replies - 16 through 25 (of 25 total)
  • Well!…

    Dude, do you wanna see something very weird ?

    Look at that file :

    https://koolos.com/temp/blanktesth1_4.html

    See the source…

    As you can see, you have two example… One from you, one I took from the site you linked for example.

    All I did was cut and paste the text from their source…!

    It works for their part, it don’t works for yours…

    !?!

    S.

    Thread Starter TrishaM

    (@trisham)

    So it’s ME???

    ??

    Dang, I was hoping it would be something I can fix. Not sure if I can fix me.

    So it sounds like a mystery……sigh…..

    Thread Starter TrishaM

    (@trisham)

    DUDE!! Simon, not sure what you did but I tried again – copied your page to mine and made a couple of MINOR adjustments and BANG! It looks good!

    SO now if I can just replicate that inside of WP – that’s up next to try….

    Really weird. I tried some other test, if I write word by word a paragraph in notepad++, it works… But If I cut and paste your text, it does’nt…

    Also, I discovered that it works well, or better, when the <h1> is right after the <p>…

    <p><h1>this test</h1> works well<h1> on my side</h1> no problem</p>

    <p>This test put <h1>a line break here</h1>and I don’t know why…</p>

    At a certain point, I was asking myself if it has something to do with the format of the file… utf-u, with or without bom, ansi, or unix/windows… It could maybe explain why it don’t works with WordPress, I mean, the way the data are extracted from the database… (?)

    I’m curious… What adjustments you made ?

    He he he… It’s like playing a game of Myst…

    ??

    By the way, if you want to do this only for some static pages that you don’t change so often, you could use a page template, but not write the text via wordpress, I mean, write your text directly in the template with a text editor… That could do the trick…

    S.

    P.S. I’m still really not convinced that this method is so helpful for Seach Engine Optimisation… I’m sure that it’s not…But it’s a funny problem… ??

    Thread Starter TrishaM

    (@trisham)

    I agree – I’m not convinced yet either on the actual benefits, but this is the way I’m being told to do this….

    I would use the page template method if I could, but the bloggers who will be contributing via the normal “write post” method will be using this markup style once (if?) I get this worked out.

    Basically I removed the space before and after the tag, and put the spaces as needed within the tag so it looks like this:

    <p>Blah blah blah<h1> keyword </h1>blah blah blah…

    not sure WHY but that seemed to do the trick….

    I’m still working on it but not yet having any luck within WP – in the View Source it looks perfect but still making the mysterious line break in the browser display…..so I’m still on the hunt….

    Yeah I’m too deep into this game to give it up now…he he he…….If I do figure it out I’ll be sure to post it here!

    I think people should make websites for visitors and not search engines.

    I just read the other day an article (can’t find it for the moment) that was discussing heading tags (h1-h6), and the author explained what a revelation was for him seeing a blind person surfing the net… and realizing the HUGE importance of the properly used heading tags to make that website accessible and usable for the blind person.
    Food for thought!

    If machines (search engines or anything) begin to be more important than humans – we can screw all our websites.

    Just my $0.02

    Thread Starter TrishaM

    (@trisham)

    Hi Moshu

    I totally agree with your philosophy, and I’ve read a number of similar articles about making sites accessible to vision-impaired site visitors, which I agree is good business practice as well as the right thing to do.

    Even though I agree with you, and don’t like this particular method of SEO, my understanding of the reasoning behind it is that it is supposed to tell the search engines what the page is about by pointing out (emphasizing) the most important words in the relevant content on the page. Since a lot of SEs no longer look at the <meta name=”keyword” tag any longer, this is supposed to be the new method of accomplishing what the old meta tag did, in a way that still allows the page to read in a natural fashion for site visitors.

    All this has yet to be proven to me, so I’m approaching it grumbling and growling, but at the end of the day I have a job to do and unfortunately principles don’t pay the bills.

    Thread Starter TrishaM

    (@trisham)

    Here’s an intriguing clue: I can’t explain WHY, but this works fine on POSTS (H tags appear just as normal text, no line breaks) but not on PAGES (H tags appear like normal text but do have a leading line break)….

    SO is there something different about the way the pages are formatted/rewritten as the page is assembled that is different from how posts are handled?

    I can’t give you any answer about this clue TrishaM… But at least, if it can help you, I guess it’s the same… I mean, post and pages must be both formatted/rewritten the same way… Since Pages and Posts are all stored in the same database table…

    The only difference I see between page and posts is the .php page used in your template to display it. Post are displayed with single.php and pages are displayed with page.php and the page template you use, if you use one…

    S.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    All this has yet to be proven to me, so I’m approaching it grumbling and growling, but at the end of the day I have a job to do and unfortunately principles don’t pay the bills.

    If your employer is insisting on this, and they are a US company with more than 15 employees, you might consider pointing out that their misuse of tags like you are describing here is an ADA violation, and will very likely get them sued.

    Correct markup is not just recommended, it’s the law. And if you’re an independent contractor, you have a potential liability here too. ADA lawsuits are nuisance suits, but for independent workers, they can add up quickly.

    A client who asked me to do things in this incorrect way would very quickly find that they were not my client any more.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Stop automatic insertion of line break’ is closed to new replies.