{"id":1948773,"date":"2020-12-15T02:24:31","date_gmt":"2020-12-15T07:24:31","guid":{"rendered":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/?post_type=tribe-knowledgebase&#038;p=1948773"},"modified":"2022-06-15T05:24:22","modified_gmt":"2022-06-15T09:24:22","slug":"changing-the-default-featured-image-in-photo-view","status":"publish","type":"post","link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/changing-the-default-featured-image-in-photo-view\/","title":{"rendered":"Change the Featured Image in Photo View"},"content":{"rendered":"\n<p>The Photo view that comes with <a href=\"https:\/\/theeventscalendar.com\/products\/wordpress-events-calendar\/\" target=\"_blank\" rel=\"noreferrer noopener\">Events Calendar Pro<\/a> is a great way to showcase your events if you have featured images. Sometimes it can happen, though, that you don&#8217;t have a featured image on hand for an event, or you want to use the same featured image for more events. In that case, we&#8217;ll show you how to change the featured image in Photo View to something else. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2020\/12\/photo-view-default-featured-image-1024x262.jpg\" alt=\"\" class=\"wp-image-1948777\"\/><figcaption>The default featured image in action in Photo view<\/figcaption><\/figure><\/div>\n\n\n\n<p>While photo view does provide a default featured image, it acts more like a placeholder. And there is a way to replace that featured image with a bit of code.<\/p>\n\n\n\n<p>First, make sure that you have your desired default featured image uploaded into your media library on the website. Once the image is uploaded grab its URL, because you will need to use that in the code snippet.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2020\/12\/media-library-image-url-1024x488.jpg\" alt=\"\" class=\"wp-image-1948775\"\/><figcaption>Click the &#8220;Copy URL&#8221; button to grab the direct URL of the image.<\/figcaption><\/figure><\/div>\n\n\n\n<p>Head over to your <em>functions.php<\/em> file and add the next piece of code.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;tribe_events_views_v2_view_template_vars&#039;, &#039;tribe_custom_default_featured_image&#039; );\n\nfunction tribe_custom_default_featured_image( $template_vars ) {\n\t$template_vars&#x5B;&#039;placeholder_url&#039;] = &#039;https:\/\/demo.theeventscalendar.com\/wp-content\/uploads\/coffee-mug.png&#039;;\n\treturn $template_vars;\n}\n<\/pre><\/div>\n\n\n<p>Remember to replace the image URL on line 4 with your own one. Save and you&#8217;re done. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"\/knowledgebase\/wp-content\/uploads\/2020\/12\/photo-view-custom-default-featured-image-1024x295.jpg\" alt=\"\" class=\"wp-image-1948778\"\/><figcaption>The result of our work: Photo view using the custom default featured image<\/figcaption><\/figure><\/div>\n\n\n\n<p>Enjoy your new default featured image in photo view.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Photo view that comes with Events Calendar Pro is a great way to showcase your events if you have featured images. Sometimes it can happen, though, that you don&#8217;t have a featured image on hand for an event, or you want to use the same featured image for more events. In that case, we&#8217;ll&#8230;<\/p>\n","protected":false},"author":3,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,79],"tags":[20,58],"stellar-product-taxonomy":[158],"class_list":["post-1948773","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-customizing-resources","category-snippets","tag-code","tag-php","stellar-product-taxonomy-events-calendar-pro"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP &amp; Functions"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":20,"label":"Code"},{"value":58,"label":"PHP"}],"stellar-product-taxonomy":[{"value":158,"label":"Events Calendar Pro"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Jaime Marchwinski","author_link":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/author\/jaimetri-be\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":110,"filter":"raw","term_order":"0","cat_ID":24,"category_count":110,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP &amp; Functions","slug":"customizing-resources","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":101,"filter":"raw","term_order":"0","cat_ID":59,"category_count":101,"category_description":"","cat_name":"PHP &amp; Functions","category_nicename":"customizing-resources","category_parent":24},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":136,"filter":"raw","term_order":"0","cat_ID":79,"category_count":136,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":20,"name":"Code","slug":"code","term_group":0,"term_taxonomy_id":20,"taxonomy":"post_tag","description":"","parent":0,"count":33,"filter":"raw","term_order":"0"},{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":128,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1948773"}],"version-history":[{"count":1,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948773\/revisions"}],"predecessor-version":[{"id":1955974,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1948773\/revisions\/1955974"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1948773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1948773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1948773"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/dev.theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1948773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}