[Resolved] Styling text used in the Legacy Hook “before content”

Home Forums Support Styling text used in the Legacy Hook “before content”

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1330596
    Mark

    I would like to put some text at the beginning of the “About Us” page that would be styled (larger font size, different color, etc) than the text in the body of the page.

    To that end, I added placeholder content “Before Content” using the Legacy Hook “Before Content.” I would like to style the text in that Hook.

    Can you tell me how I would do that? Or if this is the best way to add styled text to a page. I’m trying to do this in a way that one of our content providers can simply add text and have it styled automatically, since she is not familiar with styling.

    Thanks in advance,

    Mark

    #1330761
    Leo
    Staff
    Customer Support

    Hi there,

    You would do something like this:

    <div class="custom-before-content">
        Your before content hook content
    </div>

    Then style it with CSS:

    .custom-before-content {
        font-size: 20px;
        color: #000;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    Also any reasons why you are not using the new hooks element module?

    #1330791
    Mark

    Hi Leo,

    Thanks for your reply. I tried using the legacy hook, which I guess is different than the New Element hood. However I couldn’t figure out how to target that spot so I could add CSS.

    #1330794
    Leo
    Staff
    Customer Support

    My method above would work in both the legacy hook and hooks element.

    Have you tried it?

    #1331728
    Mark

    Leo,

    I haven’t yet. I just realized I would put the CSS in the “Additional CSS” spot in the customizer – that should work I think. I was thinking the hook page would have a box for CSS since I’m using “Simple CSS.”

    Mark

    #1331759
    Leo
    Staff
    Customer Support

    Nope there is no SimpleCSS metabox on the hook page.

    Additional CSS would work better as it would apply the style globally.

    #1331790
    Mark

    Leo,

    Thanks for getting back to me. Since the person adding the content is not technical, I think it is easier for her if I just add the content to the page itself using your original method. That was she can use a visual editor to add/edit content.

    Is there some disadvantage to this method, as opposed to using the Before Content hook?

    Thanks
    Mark

    #1331866
    Leo
    Staff
    Customer Support

    If you use the hook then you only need to add the content once.

    If you add it as a page content then you’d need to add it everytime you want the content to show.

    #1331970
    Mark

    Ok, thanks

    #1332022
    Leo
    Staff
    Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.