{"id":1614764,"date":"2018-09-05T17:07:47","date_gmt":"2018-09-06T00:07:47","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/"},"modified":"2018-09-05T17:07:47","modified_gmt":"2018-09-06T00:07:47","slug":"redirecting-links-in-calendar-code-snippet-goes-where","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/","title":{"rendered":"Redirecting Links in Calendar &#8211; Code Snippet Goes Where?"},"content":{"rendered":"<p>I have Events Calendar PRO and am curious to if it\u2019s possible to redirect various links on pages dedicated to specific events. For instance, above the title of an event there is a way to go back to \u2018All Events\u2019, however it directs users to the primary page that the event calendar URL is, but I\u2019d prefer it to go to another page on my website. Is there a way to do this?<\/p>\n<p>I received this code snippet as an answer to this question, but I&#8217;m not sure where to insert it so as to get it to work. Anyone able to help?<\/p>\n<p>&lt;?php<br \/>\n\/**<br \/>\n * The Events Calendar: Turn the &#8220;All Events&#8221; link into a true &#8220;Back&#8221; button.<br \/>\n *<br \/>\n * Generally not advisable but provided at customer&#8217;s request:<br \/>\n * https:\/\/theeventscalendar.com\/support\/forums\/topic\/upcoming-events-8\/<br \/>\n *<br \/>\n * @link https:\/\/gist.github.com\/cliffordp\/60b5acf003fa68ad7803313d662c08e7<br \/>\n * @link https:\/\/css-tricks.com\/snippets\/javascript\/go-back-button\/<br \/>\n * @link https:\/\/api.jquery.com\/replacewith\/<br \/>\n *\/<br \/>\nadd_action( &#8216;wp_footer&#8217;, &#8216;cliff_all_events_link_replaced_with_back_button&#8217; );<br \/>\nfunction cliff_all_events_link_replaced_with_back_button() {<br \/>\n\twp_enqueue_script( &#8216;jquery&#8217; );<br \/>\n\t?&gt;<br \/>\n\t&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n\t\tjQuery( document ).ready( function () {<br \/>\n\t\t\tvar all_events = jQuery( &#8216;p.tribe-events-back a&#8217; );<br \/>\n\t\t\t\/\/ The following line is commented out because an &#8220;All Events&#8221; link that goes back to say the Blog Posts page would confuse the user.<br \/>\n\t\t\t\/\/ var button_text = all_events.text().trim();<br \/>\n\t\t\tvar button_text = &#8216;&laquo; Go Back&#8217;;<br \/>\n\t\t\tvar new_element = &#8216;&lt;input type=&#8221;button&#8221; value=&#8221;&#8216;;<br \/>\n\t\t\tnew_element += button_text;<br \/>\n\t\t\tnew_element += &#8216;&#8221; onclick=&#8221;history.back(-1)&#8221; \/&gt;&#8217;;<br \/>\n\t\t\tall_events.replaceWith( new_element );<br \/>\n\t\t} );<br \/>\n\t&lt;\/script&gt;<br \/>\n&lt;?php<\/p>\n","protected":false},"template":"","class_list":["post-1614764","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redirecting Links in Calendar - Code Snippet Goes Where? -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redirecting Links in Calendar - Code Snippet Goes Where? -\" \/>\n<meta property=\"og:description\" content=\"I have Events Calendar PRO and am curious to if it\u2019s possible to redirect various links on pages dedicated to specific events. For instance, above the title of an event there is a way to go back to \u2018All Events\u2019, however it directs users to the primary page that the event calendar URL is, but [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/\",\"name\":\"Redirecting Links in Calendar - Code Snippet Goes Where? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-09-06T00:07:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Redirecting Links in Calendar &#8211; Code Snippet Goes Where?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redirecting Links in Calendar - Code Snippet Goes Where? -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/","og_locale":"en_US","og_type":"article","og_title":"Redirecting Links in Calendar - Code Snippet Goes Where? -","og_description":"I have Events Calendar PRO and am curious to if it\u2019s possible to redirect various links on pages dedicated to specific events. For instance, above the title of an event there is a way to go back to \u2018All Events\u2019, however it directs users to the primary page that the event calendar URL is, but [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/","name":"Redirecting Links in Calendar - Code Snippet Goes Where? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-09-06T00:07:47+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/redirecting-links-in-calendar-code-snippet-goes-where\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Redirecting Links in Calendar &#8211; Code Snippet Goes Where?"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1614764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1614764\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1614764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}