I need to change Wordpress theme function.php file so it will show custom name for post on frontend which is different than the title in post editor/URL.
For instance: Post title in text editor/url is "New York" but on front end will be shown "New York - never sleeping city". The reason for this is to shorten URL to basic metadata and keep "fancy name" on frontend only (posts, archives, sitemap, search results...). For "fancy name" I would like to use SEO title from Yoast SEO plugin.
In my case the pages are based on Wordpress posts types. So I need to define somewhere pool of posts(pages) IDs which should not be affected. The best solution is also NOT to affect all descendant pages under listed IDs.
The question is how should I modify function.php file?
Note for community: if you see my question as not clear, please write comment before you will mark my question as off-topic so I can tune it and make it better.