• Resolved wpress2010

    (@wpress2010)


    Client has enormous Excel file, all text, basically magazine article listings with subject, article title, author, issue number, etc. Easily imported into WordPress via MyPhpAdmin as new table, Excel–>CSV–>MySql. So, is just another WordPress table in the database.

    I want to allow a user to search this table, and display the results on a WP page. Given the huge amount of data (several thousand rows…), I will hide the data from the user and just let him/her search.

    I was able to set up Pods to allow Advanced Content Types and Advanced Relationships, but I can’t see quite how to select my EXISTING custom table as a custom data type when creratinbg a new pod.

    Can someone point me in the right direction? I have created this type of query in PHP before, but not from within WordPress. If Pods can help me avoid having to do custom coding using the wpdb (WordPress Database Access Abstraction Object), it would help me a great deal.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    You’re going in the right direction, but unfortunately you put the cart before the horse.

    Advanced Content Types are used to create a completely stand alone table within the WordPress installation that you can use ‘similar’ to Custom Post Types. You build the structure with Pods and then import data into it. You _can_ make the table you’ve already created be represented in Pods using Advanced Content Types, but it’s not terribly straightforward as you have to create and name the table and it’s field exactly as they already exist when you’re creating it and then it should ‘pick up’ the existing table. Typically, it’s easier to create the table first in Pods and then import your records into it, in the same method you’ve already done.

    The problem with Advanced Content Types is: none of the content within these tables is visible to WordPress search, etc. methods, because they don’t exist in the WordPress post/postmeta structure and are invisible to its API’s. You will have to write your interface completely within our Pods API. Doable, yes, but requires Custom Coding which it sounds like you wanted to avoid. https://pods.io/docs/code/pods/ is the style of coding you’d be doing and specifically within the https://pods.io/docs/code/pods/find/. It’s not ridiculously complicated and it’s fairly easy to create table views with Advanced Content Types and the pods_ui (https://pods.io/docs/code/pods-ui/). Again, assuming you’re comfortable with PHP.

    Advanced Relationships is only used to create a relationship field INTO an existing table. It’s primarily for ‘linking’ existing post types, etc. to an external table that sits on the WordPress database primarily for display, like financial records etc. that sync to a customer post-type. You can’t really ‘peek’ into the external table for search.

    Hope this helps and alleviates some of the confusion.

    Thread Starter wpress2010

    (@wpress2010)

    Thank you – this is very helpful.

    It occurred to me that perhaps there is another way to approach this task. Basically, (I have not seen the actual Excel file itself, yet…) the client has entered into a large Excel sheet the various details of each issue of his archived newsletters, of which there are 4 issues per year, maybe 25 years’ worth, so that’s about 100 issues total. If the entries for each issue are contained in a single Excel row (I don’t know that they are…), it might be better to just import the Excel data into WP posts, and go from there, since searching/manipulating the display of posts is something really simple to do in WP. Even if custom fields were needed, given the manageable number of records, I don’t see why this couldn’t be handled via MySQL as needed. I’m just trying to get ahead of the curve before this stuff is handed off to me…

    Plugin Contributor Jim True

    (@jimtrue)

    Oh that’s nothing as far as content goes. You can import that into a Custom Post Type just fine with no issues whatsoever. That is not a large dataset by any means and yes, any search that supports Custom Meta and Custom Post Types should work just fine (Relevanssi, Searchly, SearchWP, many others).

    Thread Starter wpress2010

    (@wpress2010)

    Actually, it also seems that there might be an even simpler way to access this material. Since each issue of their newsletter is just a PDF, and they want people to be able to download an issue in which they are interested, a plugin such as SearchWP might be the easiest way to go. As all attachments are just another kind of post, a custom search that was set to look at attchments only – could do the job.

    Plugin Contributor Jim True

    (@jimtrue)

    There ya go.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Use existing WordPress custom table?’ is closed to new replies.