WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I force new lines in the header.php file (2 posts)

  1. cadfile
    Member
    Posted 1 year ago #

    This going to sound strange but I have various plugins and a manual function that adds stuff to the header when it renders. All is good unless something important gets pasted on the same line as a comment then it seems to be ignored like the comment. How can I force items to start on a new line when being added to the theme files like the header

    Here a link to some code as an example:
    http://pastebin.com/wfTZ7aDW

    I want to force my function that adds the tags to always start on a new line.

    Yes I can use a plugin but I want to control this myself with a function

  2. cadfile
    Member
    Posted 1 year ago #

    Figured my issue out. I wasn't getting how to get my function to force a new line and figured out that I needed to put in a PHP declaration so here is the line I added to my function:

    <?php echo "\n<!-- my comment -->\n"; ?>

    That worked. It dropped down to the next line, wrote the comment, then dropped another line before writing the rest of the text in the function.

Topic Closed

This topic has been closed to new replies.

About this Topic