enter image description hereI would like to add this code to a single wordpress page. Have tried to use the plugin 'code embed' but couldn't get it to work properly. I have attached the code to the Fiddle as there is quite a bit. The above image shows the outcome when i either add a shortcode using a plugin or paste the code int the text editor in wordpress. Any help greatly appreciated.

Here's the fiddle: https://jsfiddle.net/yLqwthyr/1/

  • 2
    In Wordpress, you can create shortcode to add this codes inside the content codex.wordpress.org/Shortcode_API or you can manually by using this conditional function is_page('your-page-id') .
    – GKS
    Dec 5, 2016 at 11:12
  • The above is correct. A lazier option would be to copy the code (HTML and JS) and the CSS into the text view of your single specific page....
    – user23355
    Dec 5, 2016 at 12:56
  • Tried a few different options and when i put it straight into the text editor it messes up the css and js
    – Chas18639
    Dec 5, 2016 at 12:59

1 Answer 1

function bettingModuleFunction(){
    // your content
add_shortcode( 'print_betting_module', 'bettingModuleFunction' );

Put this in your functions.php and you can call the content using [print_betting_module] shortcode.

If you need to call this shortcode inside a file use:

echo do_shortcode('[print_betting_module]');

If you need to use your shortcode inside widgets put this in functions.php

add_filter( 'widget_text', 'do_shortcode' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.