Display every comment as code?
-
I want every wordpress comment to display as code.
Rather than asking people to “please use the
<code>tag before each post and the</code>tag after” I just want to do it automatically.It’s to help keep the proper formatting.
Each comment should look like this:
<code>hello, this is my comment…</code>Anyone know how to do this?
-
You would need to edit your comments.php template.
Thanks Christine, I tried doing that. I’ve been messing with it for the last couple of hours, and tried googling it too, but haven’t had any luck.
Do you know what to edit exactly?
This might be a backwards way of doing things actually, I really just want the same font and formatting that the
<code>tag does, so maybe this can actually be done with the CSS stylesheet rather than the comments.php file?I was able to get the CSS to display the courier font, which displays the same font that the
<code>tag does, but it still didn’t keep everything “in tact”. For example – comments started to go under the avatar on the left when I wanted to keep it in the same “block”, like they do here… But I noticed when I put<code>around it, it displayed it correct.So that’s why I thought making every comment as code would be a simple way to fix it, although probably not the best.
please post a link to your site if you want to get help with formatting questions.
Hi alchymyth, OK, sure it’s http://www.pinkfloydtabs.com
Here is a good example of a tab page that shows why I want to display comments as code: http://www.pinkfloydtabs.com/biding-my-time-guitar-tab
Notice how the 3rd comment is not aligned properly, but the 4th is correct. The 4th is using the “
<code>” tag.The “——-” hypens/lines get shortened for some reason if the code tag is not used, so that’s why I was thinking it might be easiest just to wrap each comment with “
<code>” before, and “</code>” after, unless you have any other ideas?for instance, move the font-family code from:
ol.commentlist { border-top: 1px dashed #cbcbcb; margin: 15px 0 0 0; padding: 15px 0 0 0; color:black;font:12px Courier New,Courier,monospace; }to:
ol.commentlist li p { display: block; margin: 6px 0 0 75px; line-height: 1.5em; font:15px Courier New,Courier,monospace; }OK, I moved it like you suggested, but it’s still showing the lines incorrectly.
Notice the 3rd comment here looks weird.
It is actually typed like this:
E :------------------------|------------------------| B :------------3-----3-----|4---5-6---5-------------| G :1-----1-----2-----2-----|6---7-8---7-------------| D :2-----2-----1-----1-----|5---6-7---6-------------| A :2-----2-----2-----2-----|6---7-8---7-------------| E :0-----0-----------------|------------0-----------|But it is displaying it isn’t displaying it like that as you can see.
It only seems to show correctly if I add the
<code>tag before and after. So that’s why I was thinking maybe just make every comment add that<code>tag automatically. Which can probably be done in the comments.php file, unless you know of a way to fix it in the css?nothing to do with the css formatting – that comment seems to be using different characters for the hyphens;
from the html in the browser:
<p>E :————————|————————|<br> B :————3—–3—–|4—5-6—5————-|<br> G :1—–1—–2—–2—–|6—7-8—7————-|<br> D :2—–2—–1—–1—–|5—6-7—6————-|<br> A :2—–2—–2—–2—–|6—7-8—7————-|<br> E :0—–0—————–|————0———–|</p>It’s not using different characters… I just made a new comment to be sure… Here is exactly the comment I made:
E :------------------------|------------------------| B :------------3-----3-----|4---5-6---5-------------| G :1-----1-----2-----2-----|6---7-8---7-------------| D :2-----2-----1-----1-----|5---6-7---6-------------| A :2-----2-----2-----2-----|6---7-8---7-------------| E :------------------------|0-----------------------| B :0---------0-----------0-|--0---4-----3---3-2-----| G :0---0-----------0-------|----0-----0---0---------| D :------------------------|------------------------| A :------0---2-------------|------------------0---2-| E :0---------0-------0-----|0-----2-----3-----------| and if you don't mind... E :0-----0-----------------|------------0-----------|And here is how it is showing up:
E :————————|————————| B :————3—–3—–|4—5-6—5————-| G :1—–1—–2—–2—–|6—7-8—7————-| D :2—–2—–1—–1—–|5—6-7—6————-| A :2—–2—–2—–2—–|6—7-8—7————-| E :————————|0———————–| B :0———0———–0-|–0—4—–3—3-2—–| G :0—0———–0——-|—-0—–0—0———| D :————————|————————| A :——0—2————-|——————0—2-| E :0———0——-0—–|0—–2—–3———–| and if you don’t mind… E :0—–0—————–|————0———–|You can view it here: http://www.pinkfloydtabs.com/biding-my-time-guitar-tab#comment-58 – it’s the 6th comment.
It appears to be “shortening” the —– lines for some reason. I don’t know why or how to fix it.
Christine, do you know how to do it the comments.php way? I tried adding the
<code>tags to the area where I thought it should go but it didn’t work.alchymyth, any other ideas? or anyone else?
I’ve tried fixing this for hours/days, is why I ask for help. It seems like it would be so simple. I tinkered with messing with both the comments.php and stylesheet as well as googled the problem looking for similar answers but can’t find anything. So only after trying so hard, have I came here asking for help. It’s probably such a simple fix. No one has any ideas? What can I do next, if no one here knows? Does anyone know anywhere else to get help?
The topic ‘Display every comment as code?’ is closed to new replies.