[Resolved] How to add standard text at end of a post/page

Home Forums Support [Resolved] How to add standard text at end of a post/page

Home Forums Support How to add standard text at end of a post/page

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #669901
    Rachel

    Hi,
    I would like to add some standard text in italics at the base of most posts and some pages.

    I have played with the different hooks but can’t find one that will place the text at the end of the post content but before my social share icons.(social warfare)

    The after_content hook displays after the post category meta and the social shares, the after_main_content appears after comments box.
    Could you please advise which hook will display in the area I am trying to add to?

    Thanks,
    Rachel

    #670166
    David
    Staff
    Customer Support

    Hi there,

    so by default Social Warfare filters the_content to place their icons.
    So instead you could use the SW shortcode:

    https://warfareplugins.com/support/using-shortcodes-and-php-snippets/

    Then you could try adding your type followed by the shortcode inside the after_content hook and change the priority to a lower number (it defaults on 10). This should hook it above the entry meta.

    #670240
    Rachel

    hmm, I can’t seem to get anything to display when using the after_content hook. I am not tech, so do I need to code the shortcode in a certain way within the hook to display correctly?

    #670254
    David
    Staff
    Customer Support

    If you’re using the GP Elements > Hook then you just need to Check the Execute Shortcode and set the Display Rules.

    https://docs.generatepress.com/article/hooks-element-overview/

    #670649
    Rachel

    Ok, did that. It is now showing above the SW social share, but still below the meta tags with the priority set to 1. Not sure how to get it to hop above the meta data- any ideas?

    #670769
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try the generate_after_entry_content hook instead with a low priority.

    Let me know ๐Ÿ™‚

    #670816
    Rachel

    Hooray – that worked. Thank you. Sorry for the very basic questions, but can you advise how I can adjust the text font and colours of the text in this hook? Is there a place I can find the class for certain styles? Thanks.

    #671252
    Tom
    Lead Developer
    Lead Developer

    You can add an element with a class around your content, then apply CSS to it:

    <div class="my-element">
        My content
    </div>

    Then your CSS:

    .my-element {
        color: #777777;
    }
    #671540
    Rachel

    Thank you! I really need to find a good intro to css course…

    #671587
    Tom
    Lead Developer
    Lead Developer

    Codecademy is pretty cool: https://www.codecademy.com/

    #671609
    Rachel

    Thanks for the tip. Cheers.

    #671649
    Tom
    Lead Developer
    Lead Developer

    No problem ๐Ÿ™‚

    #715109
    Rachel

    Hi, So I have been using this element to add standard text to the bottom of posts, but it doesn’t show up for pages. I have set the custom hook element with the display rules all singular, plus added individual pages in the location section, but no luck.
    Is there a way I can specify this hook to be displayed at the base of specific pages? Thanks.

    #715370
    David
    Staff
    Customer Support

    Hi there,

    you would need to create a separate Element Hook and use one of the available hooks for the static pages, this guide displays where they are:

    https://docs.generatepress.com/article/hooks-visual-guide/#static-page

    #716008
    Rachel

    Ok, thanks – that worked. Cheers. Will save that link for later!

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.