Adding comment in source code

  • Unknown's avatar

    Hello wordpress team.
    We need to credit the pattern background we’re using in the source code.
    <!-- pattern by: http://subtlepatterns.com -->
    Do I do this with CSS?
    Thanks in advance.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    You can put it as a comment in the CSS like this:

    /*pattern by: http://subtlepatterns.com*/

    Alternately, you could add it to the bottom of the existing WordPress.com footer credits (below your copyright with the following CSS.

    footer[role="contentinfo"] div.copyright:after {
        content: " Pattern by http://subtlepatterns.com";
    }

    If you wanted it there, but invisible, you could put it before the WordPress.com footer credits and set the color to white so it would not show. It will actually be above the CC logo you have, right aligned.

    footer[role="contentinfo"] div.copyright:before {
        content: " Pattern by http://subtlepatterns.com";
        color: #FFFFFF;
    }
  • Unknown's avatar

    Hello.
    Maybe I’m doing something wrong.
    I add the 3rd code in the CSS, have tried with #000 but can’t see it.
    And also look for it in the ‘view source’ of the html and nothing.
    Thanks.

  • Unknown's avatar

    Heh, sorry about that. I must have been looking at the wrong site. Try the following instead. Before puts it before Blog at WordPress.com. After would put it after the Customized Snap Theme.

    #theme-byline:before {
        color: #000000;
        content: " Pattern by http://subtlepatterns.com";
    }
  • Unknown's avatar

    Don’t worry!
    Now it appears on the footer.
    The problem here, if we can call that, it’s we don’t want this info to be public, but we need the credit to be visible in the html as a comment. When I right-click to view source.

  • Unknown's avatar

    There really isn’t anyway to add comments in the HTML itself since we cannot edit the theme files. You could add a text widget and add it to that, but it would be publicly visible in the page source code, even if it was the same color as the background.

    You might contact subtlepatterns.com and see if putting it in the footer, not visible to the public unless they viewed the source code, would be alright. You can explain that you cannot edit the HTML files at WordPress.com to add the comment.

  • Unknown's avatar
  • Unknown's avatar

    You know, you could put it into a text widget without a title, wrapped in a div and it will not show up to the public.

    <div><!-- pattern by: http://subtlepatterns.com -->&nbsp;</div>

    What will show up if you view the source code will be the following:

    <div> </div>

  • Unknown's avatar

    Yes, it’s working! Thank you very much. Only in the blog source code, but that’s fine. I also kept the css comment. Just in case.

    You might contact subtlepatterns.com and see if putting it in the footer, not visible to the public unless they viewed the source code, would be alright.

    It’s OK for them in the source code.

  • Unknown's avatar

    Great! Glad things are sorted out. Happy blogging!

  • Unknown's avatar
  • The topic ‘Adding comment in source code’ is closed to new replies.