Can't get DataTable to show in Wordpress page

Can't get DataTable to show in Wordpress page

schaumannschaumann Posts: 1Questions: 0Answers: 0
edited February 2012 in General
Hi guys,

I'm hoping this is an easy one to fix!

I currently use WP-Table Reloaded but I'd like to migrate to a fully manual DataTables system instead, due to a few bugs with WP-Table Reloaded that won't currently allow me manipulate my tables. I'm having trouble integrating it into Wordpress though.

Here is a test page where DataTables works perfectly:

http://australiabysong.com.au/test.htm

I have included this initialisation at the top of the page:

[code]
@import "/DataTables/media/css/demo_table.css";




$(document).ready(function() {
$('#australia').dataTable();
} );
[/code]

My problem is, when I integrate this into a Wordpress page, DataTables doesn't load. This is a test page within Wordpress:

http://australiabysong.com.au/test/

I use the same initialisation but nothing I can do will get DT to load.

Does anyone have any ideas on what I'm doing wrong here?

Much appreciated,

Dan

Replies

  • stemiestemie Posts: 4Questions: 1Answers: 0
    edited October 2012
    I think you need to add those scripts into the header.php of your wordpress theme. Perhaps use a conditional statement so it only loads that javascript on the page you want as opposed to it loading on every page - http://codex.wordpress.org/Conditional_Tags

    You can also access a separate database from within worpdress by using wpdb functionality.
    You would add the below code to functions.php
    [code]$newdb = new wpdb($DB_USER, $DB_PASSWORD, $DB_NAME, $DB_HOST);
    $newdb->show_errors();[/code]

    http://codex.wordpress.org/Class_Reference/wpdb
This discussion has been closed.