Site logo

[Support request] Create custom stiky subheader

Home Forums Support [Support request] Create custom stiky subheader

Home Forums Support Create custom stiky subheader

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2013839
    Michele

    Hi everyone, I’m trying to figure out how to create a sticky bar under the header to be displayed only in certain posts.

    I would like to avoid using plugins and was wondering if there is any solution using only my premium version of generatepress.

    Basically I would like to create a bar under the header with 3/4 columns. The columns will have an image, text and a button inside them which, depending on the post, will always be different.

    There’s a way?

    Thank you so much and good luck,
    Michele

    #2013841
    Ying
    Staff
    Customer Support

    Hi Michele,

    You can create the content using a block element:
    https://docs.generatepress.com/article/block-element-overview/

    Choose hookas element type, choose after_header as hook name, choose location depends on your needs (certain posts).

    Once it’s done, link us to your site, we can have a look to provide some custom CSS to make it sticky 🙂

    #2013842
    Michele

    Thank you so much Ying! So basically I should create a block for each post, is that correct?

    Don’t risk make heavy the site too much with, say, 200/300 blocks?

    #2013847
    Ying
    Staff
    Customer Support

    So basically I should create a block for each post, is that correct?

    It depends on the content, are they static contents and all different on different post? Or are they pulling custom field values from the each post?

    If it’s the first case, then you need to create a block element for each post.

    If it’s the second case, then you would want to use the dynamic feature of the block element (requires GenerateBlocks plugin installed and activated), only 1 block element is needed.

    But I would recommend using dynamic feature in your case since you are having 200/300 posts 🙂

    #2014914
    Michele

    Hi Ying, with your advice I was able to create what I was looking for. A thousand thanks.

    I have only one problem left to solve.

    I created a sticky bar with 3 columns, the first two are dynamically populated with cover image and post title, in the third column I inserted a button.

    However, the link within the button must change based on the post. It will be an affiliate site and each post will have its own “product”. How can I avoid creating hundreds of blocks and using only a dynamic one?

    I leave you the link to the test page, do not pay attention to the desktop part but just look at the mobile one. At the moment this is a test site just to create the layout for the official site.

    https://passionecuccioli.com/carta-prepagata-tinaba/

    #2015637
    Ying
    Staff
    Customer Support

    You can use custom fields of WP in the post editor: https://wordpress.org/support/article/custom-fields/

    Create a custom field to store the product link, then use the button to pull the link from the custom field.

    Here’s a demo video which uses custom field content, you can start to watch from 0:57 to see the custom field in the post editor: https://youtu.be/H6wHd83DfDI?t=57

    Let me know if this helps 🙂

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