Output URL as page title instead of full web address
- This topic has 7 replies, 2 voices, and was last updated 9 years ago by
Truong Giang.
-
AuthorPosts
-
September 5, 2017 at 8:45 AM #6878
janek
ParticipantGood morning,
I'm trying to setup a URL metabox on the backend of WordPress that allows the user to input multiple URL addresses that then appear on the front end using a shortcode within a html widget. This works fine for displaying the web address however I'd like it to display page title instead. For instance if one of the URLs linked to a youtube video I'd prefer the youtube video/page title to be listed on the front end instead of the full web address.
Is there a simple way to do this or would to require a lot of coding?
September 5, 2017 at 10:30 AM #6882Truong Giang
ParticipantHi there,
I haven't got fully your problem. Can you describe more detail?
September 5, 2017 at 10:40 AM #6884janek
ParticipantSo basically I'd like links to display a page title instead of the full url.
For instance if I put http://www.google.com in as URL it would be better if it displayed as Google (page title) instead of the url.
I've attached a imgur gallery showing what I have set up on the backend and frontend
Hopefully this is clear. Let me know if you need to know more.
September 5, 2017 at 12:05 PM #6886Truong Giang
ParticipantHi,
Why don't you use another field for user to fill the page title?
September 5, 2017 at 1:30 PM #6888janek
ParticipantIs there a way to do this and have that page title override the full web address? For instance the user inputs the url "http://www.google.com" and the page title as "Google" then on the front end it just displays the url as "Google".
I mainly want to do this to provide a better experience for visitors and minimise the clutter while also making it easy for an author in the back end to add a list of URLs to the page sidebar.
See link for example of the sidebar in action:
https://a15e3113.ngrok.io/academy-sports/tennis/September 6, 2017 at 9:07 AM #6905Truong Giang
ParticipantI think you must create a new shortcode to turn a url to the format you want. I hope this link can help you: https://stackoverflow.com/questions/4348912/get-title-of-website-via-link
September 6, 2017 at 12:23 PM #6907janek
ParticipantPretty much exactly what I want. I'll have to ask about StackOverlow and see if someone can help me implement it with the short code.
September 6, 2017 at 2:40 PM #6908Truong Giang
ParticipantThis is WordPress Shortcode API documentation: https://codex.wordpress.org/Shortcode_API
I hope it's helpful for you. -
AuthorPosts
- You must be logged in to reply to this topic.