Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Terry Lin 01

    (@terry-lin-01)

    I am new to WP and not code savvy /:

    Thread Starter Terry Lin 01

    (@terry-lin-01)

    Please help /:

    Thread Starter Terry Lin 01

    (@terry-lin-01)

    Please, no one help me, bros and sisters /:

    If you still didn’t find the answer this is it:
    go to /wp-includes/post-template.php in your WordPress instalation.

    Go to line 231 of post-template.php and change:

    $content = str_replace( ‘]]>’, ‘]]>’, $content );

    to

    /* $content = str_replace( ‘]]>’, ‘]]>’, $content ); */

    That is it, at least to the next WordPress update, then you might have to do it again.

    Thanks S1awek,

    That works like a charme!
    However not very good for workflow if this needs to be done over and over again after every core update.

    I there a way to maybe copy that post-tamplate.php into the child themes folder so the modification stays intact like with the function.php, style sheet customizations, footer.php etc?

    Any idea’s if and how to make that happen?

    Thanks,
    Annie

    I’m happy that I could help.
    I think that keeping core WP files out of date is not a good idea for security and compatibility reasons.
    You can change it manually after every update, or get a script which will do that for you.
    If you don’t know how to create such a script just hire freelancer, try at fiver.com
    Cheers

    Hi S1awek,

    I found a snippet that does this and have implemented an tested it succesfully. I will share it here, it might help someone else.

    http://businessbloomer.com/woocommerce-add-conversion-tracking-code-thank-page/

    Basically you need to add this code snippet ( ofcourse replace it with the specific conversion code needed ) into the child themes functions.php:

    /**
    * @snippet Add Conversion Tracking Code to Thank You Page
    * @how-to Watch tutorial @ http://businessbloomer.com/?p=19055
    * @sourcecode http://businessbloomer.com/?p=19964
    * @author Rodolfo Melogli
    * @testedwith WooCommerce 2.5.2
    */

    add_action( ‘woocommerce_thankyou’, ‘bbloomer_conversion_tracking’ );

    function bbloomer_conversion_tracking() {
    ?>
    <!– Google Code for Conversion Page –>
    <script type=”text/javascript”>
    /* <![CDATA[ */
    var google_conversion_id = 000000000000;
    var google_conversion_language = “en”;
    var google_conversion_format = “3”;
    var google_conversion_color = “ffffff”;
    var google_conversion_label = “kjsdhfkjhkfsdfsdf”;
    var google_remarketing_only = false;
    /* ]]> */
    </script>
    <script type=”text/javascript” src=”//www.googleadservices.com/pagead/conversion.js”>
    </script>
    <noscript>
    <div style=”display:inline;”>
    <img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=”//www.googleadservices.com/pagead/conversion/000000000000/?label=kjdhfsdjfkjkjshdkkkjsdkk&guid=ON&script=0″/>
    </div>
    </noscript>
    <?php
    }

    After ofcourse saving the functions.php the conversion code will work on the default Woocommerce thank you page ( my account end point ) where a costumers lands on after closing an order or purchase in Woocommerce checkout. This works great, without the need of altering the code in the wp core files and the need to do this over and over again.

    I still appreaciate your help, it does work like a charme, but this one has no need to alter after updates.

    Hope this helps someone else too!

    Thanks a lot,
    Annie

    Johnny Sea

    (@lanceryanriley)

    I made the change that S1awek suggested, but still seeing the CDATA error with the tag assistant.

    Is there something else I’m missing?

    Hi Johnny,

    Did you by any chance forget to save the /wp-includes/post-template.php after making those changes?

    Did you recently upgrade to WP 4.5 and is that file overwritten?

    Oh, and do you have some caching plugin going on? Did you flush the cache, clear the browsers cache?

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Missing 'CDATA' Comments’ is closed to new replies.