Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1194412
    neilhartley
    Participant

    Hi,

    I wanted to add a shortcode to Cornerstone so I added this code (found on the forum) to my child theme functions.php file:

    function load_script_content() {
    return “<script type=”text/javascript” src=”https://tb109.infusionsoft.com/app/form/iframe/4fc552c4bb96829c0f73a94284297b58″></script>&#8221;;
    }

    add_shortcode(‘custom_script’, ‘load_script_content’);

    As soon as I hit “update”, I lost access to Appearance/Plugins and most of the WP capabilities. Apart from the homepage, the site is down.

    Can someone take a look for me please? I’ll send login separately.

    Thanks, Neil

    #1194415
    neilhartley
    Participant
    This reply has been marked as private.
    #1194526
    neilhartley
    Participant

    I’ve been able to get the back-end/site working again by changing the name of the child theme in cpanel –> default theme; and then back to the original name after I deleted the change I made in the functions.php file.
    The only problem is I want to create the shortcode for use in Cornerstone…was there something wrong with the code I used above?

    #1194621
    Jade
    Moderator

    Hi Neil,

    You can try using this code in the child theme:

    add_action( 'wp_enqueue_scripts', 'load_script_content' ); 
     
    function load_script_content() {
    	wp_enqueue_script( 'my-script', 'https://tb109.infusionsoft.com/app/form/iframe/4fc552c4bb96829c0f73a94284297b58', array(), '1.0.0', true );
    }

    Hope this helps.

    #1194638
    neilhartley
    Participant

    Thanks. How do I use that in Cornerstone? There is not shortcode element and when I use [my-script] in a text element I only see [my-script] when previewing. At least it didn’t crash!

    #1194664
    neilhartley
    Participant

    Sorry, maybe I didn’t explain well enough. I only want to use the shortcode one time in a specific place on a page. What you sent me, appears on every page underneath the footer.

    #1194834
    Jade
    Moderator

    Hi Neil,

    Try to add the JS code in a Raw Content element instead.

    Let us know how it goes.

    #1195803
    neilhartley
    Participant

    I tried that. If I enter the code in the element, I just see the code displayed on the page. I then added the code to settings but then I don’t see how to link the raw element to what’s in settings. Any help gratefully received! Thanks, Neil

    #1195969
    Rupok
    Member

    Hi there,

    If you want to use within page using RAW Content then you need to place the plain script there within script tag NOT the link to external file file.

    Let’s try and provide the page URL where you are trying to add this.

    #1196008
    neilhartley
    Participant

    I provided the login details earlier in this thread. The page I want to add this to is in draft called Getting Started. It’s section 6 on that page. Thanks!

    #1196403
    Rad
    Moderator
    This reply has been marked as private.
    #1196418
    neilhartley
    Participant

    That looks great. The only thing is, when I try to Edit with Cornerstone to look at how you achieved it, I get bounced back to the login screen…

    #1196845
    Rad
    Moderator

    Hi there,

    It shouldn’t redirect you to the login page if you’re already logged in. It’s draft page where normal user can’t see, hence, you’ll have to login.

    Thanks!

    #1197339
    neilhartley
    Participant

    I tried several ways all where I’m logged in, yet when I click Edit with Cornerstone it takes me back to the login screen. I’m sorry but it’s what happens.

    #1197382
    neilhartley
    Participant

    It was set as Published not as Draft. When I set it to Draft I was able to edit it using Cornerstone. Thanks for your support!

  • <script> jQuery(function($){ $("#no-reply-1194412 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>