Jump to content

[Share] Add a custom section to top of Event Detail (Use Not Linked Page)

Recommended Posts

Note: This requires a custom plugin

#1. First, you add a Blank Page in Not Linked with Name/URL:

  • Name: Event Top Section
  • URL: /event-top-section

add-a-section-to-top-of-event-detail-use-not-linked-page-01-min.png.32b2dc09835f6537c686df310a554034.png

Next, design the page layout to what you want, here is an example. You can use a Saved Section to add it here.

add-a-section-to-top-of-event-detail-use-not-linked-page-02-min.png.d053b7dcf6687e395d4e26815ea8ff24.png

#2. Install Section Loader Plugin (referral link) or this link (non-referral link)

The plugin will give you some code to add to the Code Injection Header and footer, like this.

add-a-section-to-top-of-blog-posts-use-not-linked-page-03-min.jpg.526a9e81ba5f10ac1b457fff040e0f68.jpg

add-a-section-to-top-of-blog-posts-use-not-linked-page-04-min.jpg.b3eac1a09f64083ff8fda932a0783a14.jpg

#3. Add this code to the Event Page Header Code Injection

<div data-wm-plugin="load" data-target="/event-top-section"></div>

add-a-section-to-top-of-event-detail-use-not-linked-page-03-min.png.929a7d042f1ed31512b5216e8414cdf8.png

#4. Add this code to the Website > Website Tools > Custom CSS box

div.wm-load-container {
  display: none;
}
body[class*="type-event"].view-item div.wm-load-container {
  display: flex !important;
}

add-a-section-to-top-of-event-detail-use-not-linked-page-04-min.png.b38cc4c057824311e96cfedaeacabfa4.png

#5. Add this code to Website > Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
document.addEventListener('wmSectionLoader:loaded', ({detail}) => {
  if (detail.target !== '/event-top-section') return;
  $('div.wm-load-container').insertBefore('body[class*="type-event"].view-item article>section:first-child');
})
</script>
<style>
.wm-load-container+section {
    padding-top: 0px !important;
}
</style>

add-a-section-to-top-of-event-detail-use-not-linked-page-05-min.png.1041d90a400f2d70c823d19768950450.png

#6. Result

add-a-section-to-top-of-event-detail-use-not-linked-page-07-min.jpg.7da2b16d04428675e94de74ac64eac28.jpg

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 595
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.