Trying to make a plugin for wordpress

Trying to make a plugin for wordpress

PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
edited January 2014 in Blog
to start off im not sure if im posting this in the right place, sorry if its wrong.
I am trying to make a plugin just for use of my self for my blog i run with my friends, and im strugling on how to do this i would really be grateful if someone can help

Replies

  • netametanetameta Posts: 39Questions: 0Answers: 0
    a wordpress plugin that has nothing to do with Datatables Yet you post it in dataTables forum ?

    You need to go to wordpress and ask there.
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    edited January 2014
    i mean using datatables for the plugin i know tablepress used datatables so i thought id come here and ask
  • netametanetameta Posts: 39Questions: 0Answers: 0
    edited January 2014
    Unless you have something to do with datatables in your WP plugins , i assume wordpress.com or http://wordpress.stackexchange.com/ is the place for WP related questions.
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    ok thanks, i thought this might of helped or some user would know
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    We can certainly help with the DataTables aspect - in terms of initialisation options, how to use the API etc, but can't really offer any advice on how to create a WordPress plug-in as such. Probably some of the folks reading the forum will know, but you are much more likely to get a response if you ask specific and detailed questions with test cases, rather than general ones, in the approbate forum (be it here, or SO or anywhere else).

    Allan
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    ok i give an example here, my website has datatables built in and i have made a table but now i want to put this on too wordpress too you can see an example i want by clicking here www.xattools.com/Powerid as you can see i have a search and turned sorting off etc i want the plugin todo something simualr to this
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    Okay - what code have you currently got for the plug-in? If that's the point at which you are getting stuck, then the question is "how do I make a WordPress plug-in", in which case, you should ask over at WordPress.com or SO or somewhere that people know how to use WordPress (I don't :-) ).

    Allan
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    i can paostebin the code ive got and if you can tell what im missing i can then ask 1 of my friends to help me with it.
    this is the code im currentlyusing http://pastebin.com/w19amwEm
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    What happens when you run that code? Do you get any errors or what?
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    i get no errors its just a table, but i wanted it to have a search option
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    Please link to a test case, as required for all forum questions - http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read .

    The page you linked to before appears to work just fine.
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    try this blog.xattools.com/test its just a table but no search
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    You have initialised your dataTable with the id '#example'. Your HTML table has no id.
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    edited January 2014
    im confused what i need to change, my table has an class if u mean this?

    EDIT: just realized what u ment i added id="datatable" in and it works i changed the "#example" too "#datatable"
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    it works http://blog.xattools.com/test/? but it only shows 10 a page and is not in the order how i want it, how would i use the files i have for my website?
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    > but it only shows 10 a page

    Use iDisplayLength to change the default from 10 to whatever you want.

    > is not in the order how i want it

    You have non-numeric data in the first column - HTML tags, which is why it is string sorting.

    DataTables 1.10 has built in support for this type of data, and you can get the latest dev version from http://datatables.net/download .

    Allan
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    i have the files for the plugin, maybe this part is not the place to ask, but currently its reading from
    http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css
    http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js and
    http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js
    i followed this http://datatables.net/blog but i cant make it read from my own files
  • allanallan Posts: 63,569Questions: 1Answers: 10,481 Site admin
    That's a WordPress question for sure - how to include local files in your plug-in. I'm afraid I don't know.

    Allan
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    hmm ok i see if i can find a wordpress place, unless anyone here is good with it?, i was also thinking would it still work if i had the same files on my server ? and not read fro wordpress it will read from the main site
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    [quote]PaulFreeWebs said: hmm ok i see if i can find a wordpress place[/quote]

    Perhaps Wordpress - Writing a Plugin? Just a wild guess.
    http://codex.wordpress.org/Writing_a_Plugin
  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    edited January 2014
    [quote]tangerine said: Perhaps Wordpress - Writing a Plugin? Just a wild guess.[/quote]

    i have seen that but that dont really explain anything to me i think i ask on the wordpress forum
  • cjbugcjbug Posts: 1Questions: 0Answers: 0
    Hey,

    If I understood the question right, you would like to know how to link the javascript and CSS files in your plugin? The best would be not to link them from external sources, since it might not work locally then, it's better to include them somewhere in your WP plugin directory. Then, the correct way to do so is to use wp_enqueue_script(), wp_enqueue_style() functions:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script
    http://codex.wordpress.org/Function_Reference/wp_enqueue_style

    But generally, I am not sure why would you need to write something that is already written. There is a bunch of plugins that use DataTables engine for rendering, consider just using them.
    E.g., commercial plugin: http://wpdatatables.com/
    Free plugin: http://tablepress.org/

    See you!
This discussion has been closed.