Adding Open Graph Tags to Main Calendar Page
I see you’re using Yoast SEO.
I believe that plugin has option to set the Open Graph tags for the Events custom post type archive, such as setting a dedicated image for your Events Archive page.
Also, just a heads up that you can test your URLs at https://developers.facebook.com/tools/debug/ so you don’t have to actually put them in your Facebook feed to preview/view them.
Please let me know how this goes for you.
Sorry you’re experiencing this.
Best practice for adding custom code (like to implement a PHP snippet to modify The Events Calendar) is to create a functionality plugin, unless it’s something specific to your theme, in which case best practice is to make sure you’re using a child theme, then add the customization to your child theme’s functions.php file.
Note that the opening <?php tag should be removed from our snippets when adding to your plugin file or your functions.php file (it’s only added to enable syntax highlighting)… unless the snippet is a complete file replacement.
I hope this information helps!
I found a much easier solution. I noticed that Facebook was picking up the featured image and description from the first two events on the calendar page. It took the text from the first event, but the picture on that wasn’t big enough for them, so they took the picture from the second event on the page. So I created a new event with an earlier start date, a distant end date and a big picture. Then I used Yoast to set the Facebook text and description. Sure enough, when I scraped the page, my new first event came up with the correct picture and description. Problem solved!! Yay!!
Thanks for your help with this.
Facebook will guess for an image if it can’t find og:image or if the og:image file doesn’t have large enough dimensions.
Your solution might work at this moment, but their guessing of what the image should be could change another day, and the solution I provided you would set the og:image for all event archive views, not just when sharing the https://www.womenarts.org/swandates/ URL
Please let me know if you want to give the custom code snippet a try again — I really think that’d be the best way, and the fix might have been as easy as simply removing the leading <?php opening PHP tag in your active theme’s functions.php file.
Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team
The topic ‘Adding Open Graph Tags to Main Calendar Page’ is closed to new replies.