Forums

Transfering content from html site to WordPress - extra white spaces (10 posts)

  1. AardvarkGirl
    Member
    Posted 1 year ago #

    What is the best way to transfer existing content from a standard html site into wordpress with out getting all the extra white spaces?

    I'm copying the 'source' of the content from Dreamweaver in the code view, the pasting it into the page on WordPress in html mode.

    Any white space, or better said line breaks in the CODE view, are showing up on the front end.

    Doing a 'apply source formatting' in Dreamweaver only cleans up the code part and not the 'text'. I've tried doing a 'find/replace' 'use regular expression' to find '\n' and it removed all new lines except, it left all the 'white spaces' that made a new line in the text.

    There has got to be a way to more efficiently move code from a standard html site into wordpress. :)

    Danke.

  2. aphill70
    Member
    Posted 1 year ago #

    This would probably actually be a problem with the fact the WordPress automatically wraps chunks of text with p tags. my guess without seeing the site itself is that your text is getting wrapped by p tags. if this isn't the problem let me know. there is a plugin that removes the filter that automatically adds p tags.

  3. AardvarkGirl
    Member
    Posted 1 year ago #

    Well... I am taking the content I need from an html file, coping the actual code and pasting it into WordPress in HTML view (not visual view).

    Ok let me show you what the code looks like when I copy it from the source mode in Dreamweaver (edited to say I even opened the file in Notepad and it is formatted the same way):

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Note how the code is all indented (and I don't mean with <li> I mean literally by white space)?
    Of course, what you copy is what you paste - this is how it is pasting into the HTML view in WordPress - yielding the same exact looking text on the front end (ie the white space forced indents, line breaks etc).

    Is there a text editor or a way I can download this website's html files and REMOVE all these white space breaks before I paste it into WordPress?

  4. aphill70
    Member
    Posted 1 year ago #

    In the past i have used a find and replace on just about any text editor just search for more than one consecutive space and replace with an empty line...

    I don't know how big your site is but in the past i have just edited out the extra carriage returns manually so that my content is all in the same line.

    you might try adding this line to your functions.php and see if it fixes the problem.

    remove_filter( 'the_content', 'wpautop' );

    the wpautop filter is what adds the extra p tags and white space that is visible on the front of wordpress.

  5. AardvarkGirl
    Member
    Posted 1 year ago #

    The site is 167 static pages. :-|

    And they have all downloaded off the server with those excessive white spaces in the text (paragraphs, li, etc).

    I did a 'find' for TWO white spaces (spacebar, spacebar) and the a 'replace' (no spaces) - and it gave me this in return:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    All it did was line things up to the right.
    *sigh*

  6. aphill70
    Member
    Posted 1 year ago #

    Ok i went into notepad++ and was able to search and replace \r\n and that removed all the new lines

    notepad++ is a free notepad application that's pretty good if you just google it it should at least save you a little bit of time :-) just make sure to replace the \r\n with a single space so that when the lines jump up they don't get mushed together.

  7. AardvarkGirl
    Member
    Posted 1 year ago #

    SHAZAM! I actually began to find a fix in Dreamweaver but was missing one part - the "... so when a line jumps up they don't get all mushed together".

    Ok here is what I did in DW - I just have to implement your tip:

    1. Create a new line break (hit the enter key)
    2. In DW in the left hand margin where the code lines are numbered right click on the number for the new line you created and hold it until it highlights the whole darn (new) line.
    3. Go into DW's 'find/replace' function - and this new line should have already been pasted into your 'find' dialog box. The replace box had nothing in it.

    This removed all the 'new lines'.

    4. I then went back into 'find/replace' and said to find double space bar and replace with nothing.

    It got it pretty good but I did notice on the front end of WordPress it did jam together a few words. I was wondering why...

    Now, this is where I needed your knowledge aphill70. Ahhhh.... I think you are on to the rest of the solution here. :)

    BIG FAT GRIN. This is going to my life easier for this project. WHEW.

  8. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  9. AardvarkGirl
    Member
    Posted 1 year ago #

    Ok, aphill70 - do tell me (since I am the queen of going thru my butt to scratch my armpit) what does \r\n mean?

    I might as well learn something while I'm here. :)

  10. aphill70
    Member
    Posted 1 year ago #

    the \r\n is what a newline character looks like in windows if you could look at it in a pure text format

Topic Closed

This topic has been closed to new replies.

About this Topic