Home › Forums › General Issues › Insert Page Title Within Shortcode
Hi,
I have this shortcode which I want to use in every page using a specific template. The shortcode is like this:
[GenericShortcodeText=”ChatName”]
However, I want it to be like this in my template:
[GenericShortcodeText=”PageTitle“]
So that I get a unique version of it with every page.
How would I go about doing this?
Thanks
Jake

Hi @jakeward – is this an ACF question, or are you more asking how to create a shortcode that returns the current page title?

Hi @jakeward ,
As noted by @markbloomfield, your question is not clear on what you are trying to achieve.
Kindly explain more on what you are trying and also please note that this is an ACF plugins forum. Thus, there maybe a limit on the nature of assistance that we may be able to provide.
Hi, @markbloomfield and James.
Apologies if I didn’t explain it well enough.
So in my pages I want to use a shortcode from a WordPress plugin and the shortcode gives you the option to make each specific instance of the shortcode unique by adding ‘=”UniqueName”‘ to it. I want each instance if the shortcode to be unique. So the way I want to do this is by making the unique name of the instance of the shortcode the name of the page.
So in my template I want to have the shortcode in their but I want it to use a unique name each for each page.
Hence:
[GenericShortcodeText=”PageTitle“]
I hope this is has made things clearer.
Thanks
Jake

Hi @jakeward
I’m afraid it’s still not clear. Could you please share some screenshots of your current page and leave notes on it that explain how you want it to be?
If you want to create a shortcode, kindly check this page instead: https://codex.wordpress.org/Shortcode_API.
Thanks!
The topic ‘Insert Page Title Within Shortcode’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.