WordPress.org

Forums

Really dumb question: What is a "backtick" for code in posts? How to type one? (23 posts)

  1. dibs
    Member
    Posted 9 years ago #

    The instructions for inserting text formatting in Forum posts says:

    Allowed tags: a em strong code ul ol li blockquote.
    Put code in between backticks.

    But what is a "backtick"? I tried a backwards accent, and then a single quote -- neither worked. I've been typing my whole life and I've never heard of a backtick before, nor do i know where to find one on a keyboard. But without knowing what a backtick is, I can't format text in my postings here.

    Thanks.

  2. Les Bessant
    keeper of the Tiggers
    Posted 9 years ago #

    That's not a dumb question at all. Backticks are the little characters nobody notices normally. On my UK keyboard the character lives at the top left of the keyboard. On US keyboards, I think it's on the same key as the tilde (~), but I'm not sure about that.

    It looks like this: `

    And I've been working with computers for more years than I care to think about, and I'd never heard the character called that before I joined these forums.

  3. dibs
    Member
    Posted 9 years ago #

    LesBessant:

    Yes, the character you describe is indeed below the tilde in the upper left corner of the keyboard. However, that was the first thing I tried -- I called it a "backwards accent" in my question. Putting code between these characters appeared to have no effect on text formatting for me.

    For example, I will try it here -- the following word "Yummy" I will try to make bold using the character you describe. Here we go:

    strongYummy /strong

    Let's see if it works!

  4. dibs
    Member
    Posted 9 years ago #

    See? Didn't work for me. On my screen, I get this:

    strongYummy /strong

    I.E. I see the code, not the formatting results the code is supposed to do.

    When I typed "strongYummy /strong" I put "backticks" around the "strongs", but they disappeared when the comment was sent.

    Still mystified.

  5. Les Bessant
    keeper of the Tiggers
    Posted 9 years ago #

    Not quite right.

    You put the backticks around the whole block of code, not around individual tags:

    <strong>Yummy</strong>

  6. dibs
    Member
    Posted 9 years ago #

    Hmmmmm...really? I never would have guess that. Let me try it that way. Here we go:

    <strong>Yummy</strong>

    Still doesn't work for me.

  7. dibs
    Member
    Posted 9 years ago #

    What do you see? Both in your comment and in mine, I see these characters:

    Yummy

    None of them are "bolded" or "strong."

    I put backticks around the whole thing (like so, indicated with single quote marks):

    'Yummy'

  8. dibs
    Member
    Posted 9 years ago #

    What???
    Now that's crazy. Now, the word "Yummy" IS bold in the comment above!! But all I did was copy the code from the previous comment (in which "Yummy" was not bold) and paste it in.

    I'm very confused.

  9. dibs
    Member
    Posted 9 years ago #

    Testing:

    Yummy in italics

    <em>Yummy in italics</em>

    emYummy in italics/em

  10. dibs
    Member
    Posted 9 years ago #

    Waiiiiiiitttttttt a minute. I think I have the whole thing reversed!

    Are you trying to tell me that the "backticks" negate the effect of the code being typed?

    My experiment above seemed to suggest that conclusion!

    I have been assuming for months that the phrase "Put code in between backticks" indicated that one must use these mysterious backticks for formatting code to function properly in posts. Since I didn't know what a backtick was, I never tried it.

    But now it is dawning on me that the "backticks" comment has nothing whatsoever to do with the text formatting for the comment itself -- the text can in fact be formatted the normal way. The "backtick" stuff is so one can input code into the comment that then WON'T have any effect.

    If this is truly the case, then I must say that "Put code in between backticks" has to be the most confusing instructions ever written.

    WordPress -- I'm sure there are thousands of people who have the same misapprehension as I do. Please think about clarifying the wording of the instructions below the comment box -- as it now stands, it only serves to make things more confusing and intimidating.

  11. Les Bessant
    keeper of the Tiggers
    Posted 9 years ago #

    Errr, what are you trying to do?

    If you want the code to be rendered, enter it as normal:

    This is bold

    If you want to show the code, surround it in backticks:

    <strong>This is how to make text bold</strong>

    If you copy the code from one comment to another, you'll be copying just that - code which will be rendered. If you want to display the copied code as code, use the backticks.

  12. dibs
    Member
    Posted 9 years ago #

    Les:

    If you want the code to be rendered, enter it as normal

    Oh my God! So that's what the instructions mean! "Backticks" = NO code works.

    I'm pounding my head on the table here.

  13. geoffe
    Member
    Posted 9 years ago #

    It's okay dibs, those instructions in the post box do presume you already understand common protocol more than explain how to work within it.

    <consolation>It's okay, really. Don't beat yourself up.</consolation>

  14. Les Bessant
    keeper of the Tiggers
    Posted 9 years ago #

    Yup. I've muttered before about the wording. And indeed about backticks...

  15. dibs
    Member
    Posted 9 years ago #

    geoffe, Les, WP admins:

    I strongly suggest that wording be changed. I'm sure I'm not the only one to have misapprehended it -- I'd be willing to bet that a substantial percentage of commenters here have been bamboozled by the instructions under the comment box.

    Here's my suggestions for what it could be changed to:

    Allowed tags: <a> <em> <strong> <code> <ul> <ol> <li> <blockquote>
    Placing "backticks" (i.e. backward accent marks) around any characters in your comment will cause them to be displayed as text and not be rendered as code.

    or something similar. By actually showing the < and > symbols in the "Allowed tags" line, you show how to format the text; and by rewording the "backticks" section, you make it comprehensible.

    Hope that helps.

  16. geoffe
    Member
    Posted 9 years ago #

    Or one could point out that using the backtick is an alternative to the <code> tag, presuming one has knowledge of what the code tag does.

    My initial confusion was with why <code> would be allowed if code is supposed to be put in backticks, but then if you do use the code tag, it is converted to a backtick if you go back and edit the post, while the posting system converts backticks stored in the support db back to code tags when outputting html. Confused? good.

  17. macsorg
    Member
    Posted 9 years ago #

    Trying this too...

    strongThis is boldstrong

  18. macsorg
    Member
    Posted 9 years ago #

    Huuuum....

    <strong>This is Bold</strong>

  19. macsorg
    Member
    Posted 9 years ago #

    ????? Geeez...

    Trying again BOLD

  20. macsorg
    Member
    Posted 9 years ago #

    Finally!!

    That footer down there is confusing.

  21. moshu
    Member
    Posted 9 years ago #

    The "backticks" are supposed to be used for preventing code to be rendered; e.g.
    <a href="something">link</a>
    as opposed to link

    The two lines above are identical, but the first one has backticks ` around it.

  22. thugparlay
    Member
    Posted 9 years ago #

    I have to agree the instructions for its use are confusing. Maybe say something like, Put code in between backtacks to prevent code being rendered... or something.

  23. aaronsportfolio
    Member
    Posted 8 years ago #

    I haven't posted before, and I don't quite understand the backticks thing, and I can't think of a better place to test it.

    Here we go.

    <?php
    
    if (is_category('xyz')) {
    
            Do something;
            }
    elseif (category('xyz2')) {
            Do something else ;
            }
    elseif (category('xyz3')) {
            Do something else;
    		}
    else {
            Do something if none of the above are true;
            }
    ?>;

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.