Format text in a text widget

  • Unknown's avatar

    How do I format some of the text in my text/html widgets? I’m trying to make some bold and have tried <b>text</b> and text but neither makes a difference. Yet these tags are listed at https://en.support.wordpress.com/code/ as allowed.

    For example, my sidebar widget, “I enjoy choir because” has the code

    [display-posts category="voice-from-the-choir" orderby="rand" posts_per_page="4" include_excerpt="true" image_size="thumbnail" wrapper="div"]
    <br>
    <b>Read more comments from the choir <a href="https://auntyclare.wordpress.com/category/voice-from-the-choir/">here</a>.</b>

    but the last sentence isn’t in bold.

    What am I doing wrong?

    Thanks for help.

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

  • Unknown's avatar

    The code for bold lettering is:
    <strong>
    </strong>

  • Unknown's avatar

    See:
    https://en.support.wordpress.com/visual-editor/
    https://en.support.wordpress.com/editors/#visual-editor
    https://en.support.wordpress.com/editors/#html%C2%A0editor

    The easiest method of creating text for a text widget is to do it in a draft post. Once you have exactly what you want in the visual editor, switch to the HTML code editor copy and paste the code into a text widget and delete the draft post.

  • Unknown's avatar

    Also note that the instructions for the display post shortcode do NOT anticipate you adding any blog lettering at all.

  • Unknown's avatar

    oops! I typed “blog” instead of “bold” above.

  • Unknown's avatar

    Thanks TT. Handy tip about using the visual editor. But doesn’t solve my problem.

    I had already tried <strong> text</strong> before trying <b>text</b>. Info at https://en.support.wordpress.com/code/ list b as a valid tag so I’d left it at that when neither worked.

    I’ve even created new text widget that is text only, no display posts. Strong tags aren’t working.

    And I’m not sure what you meant about the instructions for display post shortcode.

    But main problem, is why isn’t the formatting showing up? The page I referred to above says tags are supported in widgets.

  • Unknown's avatar

    Please use the strong tag as our editor will create bold text when you use it and the b tag will not work.

  • Unknown's avatar

    P.S. I’m multitasking from my business and answering questions at the same time.

    This code works. I tested it in my private test blog.

    [display-posts category="voice-from-the-choir" orderby="rand" posts_per_page="4" include_excerpt="true" image_size="thumbnail" wrapper="div"]
    
    <strong>Read more comments from the choir <a href="https://auntyclare.wordpress.com/category/voice-from-the-choir/">here</a>.</strong>
  • Unknown's avatar

    I’d tried the tag several times. Thanks for taking the trouble to test it. Unfortunately, it’s definitely not working on my sites. Both the test side auntyclare.wordpress.com and the Premium site I’m developing at eastlondonchorus.wordpress.com.

    Could it be something to do with the theme? (Yoko)

    I’ll flag this thread modlook. Am getting a bit frustrated as have just paid for Premium and have asked support some questions but a day later still haven’t heard back.

  • Unknown's avatar

    Oh what a hoot! I forgot writing <strong>in the post would bold it. Oops.

  • Unknown's avatar

    In the visual post editor you see a b icon. If you click the b icon and then switch to the HTML editor you will see that is becomes a <strong> tag.

  • Unknown's avatar

    Apologies to WP support.

    Herman in support did reply to all my questions a few hours ago. I hadn’t spotted the replies among a slew of other email I had. And not only did Herman give me the various bits of code I needed, he explained things and gave me links to tutorials. Excellent support.

    So many thanks Herman in WP support and apologies for my negative comment above.

    And now here’s hoping he spots this thread as it wasn’t something I’d asked about in my other enquiries :-)

  • I had a look at this and it appears that text inserted after the short code is still inside the short code’s div-tag, with the result that in Yoko’s case the short code’s formatting is overriding the strong-tag for that line.

    To get around that you need to style that line with CSS instead.

    First, remove the strong-tags and wrap that line in p or span-tags with an id-attribute:

    <p id="quotes-read-more">Text you want bolded.</p>

    Then add the following to the CSS panel in the Customizer:

    #quotes-read-more {
    font-weight: bold;
    }

    That will get the desired result.

    @timethief’s advice regarding the b-tag is correct. While it will still work, html5 prefers use of the strong-tag, so try not to use the b-tag.

  • The topic ‘Format text in a text widget’ is closed to new replies.