{"id":5738390,"date":"2015-02-01T16:39:35","date_gmt":"2015-02-01T16:39:35","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/shortcodes-and-page-title\/"},"modified":"2016-08-22T16:03:31","modified_gmt":"2016-08-22T16:03:31","slug":"shortcodes-and-page-title","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/shortcodes-and-page-title\/","title":{"rendered":"Shortcodes and page title"},"content":{"rendered":"<p>I have a problem with setting the page title.<br \/>\nI have a photo gallery plugin, with a shortcode handler. When that shortcode is placed on a page, this page acts as my photo gallery, based on query vars.<\/p>\n<pre><code>\/\/register some query vars\n\/\/....\n\/\/init shortcode\nadd_shortcode( &#039;mygallery&#039;, &#039;shortcodeHandler&#039; );\nfunction shortcodeHandler(){\n\/\/retrieve pictures from db and display them on screen based on various query vars(page, album,photoid etc)\n}<\/code><\/pre>\n<p>My problem is that i cannot find a way to set the page title from the shortcode handler itself. To show album title, photo title etc<br \/>\nThe only way i can do this is by<br \/>\n<code>add_filter( &#039;wp_title&#039;...<\/code><br \/>\nwith a filter handler.<br \/>\nBut this way i have to redo all the queries i made in the shortcode handler based on the query vars.<\/p>\n<p>So, what i want is different page title for gallery page, album page, photo page etc. I display all these pages using the same shortcode + various query vars params<\/p>\n<p>How would you solve this?<br \/>\nThanks<\/p>\n","protected":false},"template":"","class_list":["post-5738390","topic","type-topic","status-closed","hentry","topic-tag-shortcode"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5738390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5738390\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5738390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}