Hello all,
New to Ghost and having a good time coming up to speed, lots of helpful resources via the forum and Ghost support.
Today’s challenge: Use case for our newsmagazine site is no paywall but require free subscription (or any paid tier) to access some things. That means tweaking some default language on things like the post end-of-free-preview CTA and in the account portal for existing subscribers.
On the former, was able to change the language in .gh-post-upgrade-cta-content via a little code injection script found here.
Now I need to solve the same problem for .gh-portal-free-ctatext, which for subscribers has a default reference to “upgrade to a paid subscription for full access” in the portal, though we don’t require a paid tier for anything. (See image below.)
Is this possible as it was for the free-preview CTA via code injection? The portal uses an iframe so not sure if that means it’s not? Trying to do these tweaks via code injection rather than editing theme files if possible.
Code used for the CTA and portal image/text-to-change shown below.
Thanks very much.
<script>
document.addEventListener('DOMContentLoaded', function() {
const h2Element = document.querySelector('.gh-post-upgrade-cta-content h2');
const buttonElement = document.querySelector('.gh-post-upgrade-cta-content .gh-btn');
const smallTextElement = document.querySelector('.gh-post-upgrade-cta-content small');
if (h2Element) {
h2Element.textContent = 'Your New H2 Message Here';
}
if (buttonElement) {
buttonElement.textContent = 'Your New Button Text Here';
}
if (smallTextElement) {
smallTextElement.innerHTML = 'Your New Small Text Here';
}
});
</script>