I’m not quite sure what you’re getting at. If you have the code defined on each instance then you can use the same code name quite happily – the global bit only comes into play if you don’t define a global field for the code but then refer, on that page, to a field name – it will then fetch the code from wherever you’ve used it elsewhere.
I do exactly this on my own site.
David.
Example:
Post A;
Custom field is CODE1
CODE 1 = <script>EXAMPLE CODE 1</script>
Post B:
Custom field is also CODE1
CODE1 = <script>EXAMPLE CODE 2</script>
Both post A and post B can’t both use CODE1 with different script codes defined. You must give different codes different custom field names, which I would like to avoid.
Assuming the code is different in the examples you gave, you’d do as you’ve done there but on Post B you’d call it CODE2 and call it in your post as CODE2. If you then want to reference the code from post A in post B you’d then just call CODE1.
David.
I realize that but as I said in the original post:
Unfortunately I can’t keep giving each post a different custom field name so I need a way to make the page only load the %CODE1% defined on that specific page and not try to look for a code defined elsewhere.
Reason: There are CSV import plugins that allow you to mass import custom fields for posts and in these the custom field must remain fixed.
I’m still not 100% sure of where you’re coming from on this. You can call each script on each post the same thing – they can all be called CODE1 if you want. You only need to use different names if you want multiple embeds on one page or to use them globally.
David.
When I tried to use the same code on different pages it gave me an error saying the global embed was being using in multiple posts. Anyways I will try to play around abit more, thanks for the responses.
Closing due to no further response.