How to embed external backend content to wordpress? - wordpress

I have a front end website using Wordpress that I wanted to display some data from our backend website on.
I am having trouble figuring out how to set it up. In theory I could iframe a small part onto the page to list a small table on it but then the table formatted data would not be searchable from my wordpress search. Does anyone have any recommendations? My data that I want to embed could be anything I want to return but usually it will be text. It could be JSON, HTML, etc.
I have a feeling my only option would be to build a sync function that imports all my backend data to the wordpress database to then call into my page.

Your task consist of this parts:
Import data from your backend website. There are couple of ways to
that: if your backend website has a kind of API you can access data using wp_remote_get or use files for exchange data
(backend upload and frontend website read the file).
Save data in the WP. Here you can use WP Options API Or you can use wpdb object to interact with WP database.
Display data using Shorcode API
Depended on size of your data, it may be possible to skip step two and display imported data without storing.

If you are not worried about having that content indexed in the WP search, you could use the wpdb class.
https://codex.wordpress.org/Class_Reference/wpdb

Related

Wordpress: How to create frontend table using data from backend DB table

I am relatively new to WP, and am trying to figure out if the following can be done, or if a plugin exists?
I am looking to save data (500K+ rows) into a SQL table (maybe a new table in WP database), and then render the results on a page (frontend) using some basic JS and CSS. Because of the size of data, I am not sure if I should use a plugin that imports from CSV/JSON and would it slow down the site.
Do I have to go all the way and create models and views and then render to an HTML, or is there an easy hack available?
As the last resort, I am also thinking of creating the table part using Flask and SQlite and use it as main domain, and WP blog as subdomain (don't know if it will impact SEO).
Request guidance from experts. TIA
There are plugins to handle table work. Use your favorite internet search engine to find them. You'll have to experiment with various plugins to get one that meets your needs if you go that route.
There two questions here.
One is how to render a table on the front end. If you do this yourself , your best bet is to create a plugin that defines a shortcode. When you write php code for that shortcode's handler, you will include code to read and render the table. You'll probably render it as an ordinary html <table>.
Then, you'll use WordPress's content editor to create a post, or a page, that contains your shortcode. When a visitor views the post or page, your shortcode handler runs and delivers the table you want.
The WordPress plugin API also gives you a way to enqueue css and Javascript to your pages. And, jquery is an inherent part of WordPress's page loads. WordPress also contains most of jqueryUI. That's handy, because there's a really nice jquery-based plugin called Datatables that will get your users some convenient features like pagination and sorting.
The second question is how to load that data into a table. The easy way would be to do it outside WordPress, with a SQL file or some other program to bulk-load it. But if you do it inside WordPress, you'll do it from an administrative page.
If you need to be able to add, update, or delete table entries from the front end, that's going to be some work.
Explaining all this in detail is far outside the scope of a Stack Overflow answer.

Firebase Dynamic Links with parameters

I have a custom domain setup with Firebase Dynamic Links. The URL prefix is https://example.com/link and I am then able to create a new dynamic link that will resolve https://example.com/link/article to https://example.com/article within my app or on the website.
What I need to do is also pass the ID of the article that I want people to see. The copy writers need a URL structure that lets them cross-link articles, so it needs to be a URL like this: https://example.com/link/article?id=123456 but when I test this in the browser it resolves to https://example.com/article .. this should be possible right? I shouldn't have to create a dynamic link for every single piece of content should I? Would I need to add https://example.com/link/article/123456 so it links to that specific article?
If I were to create Dynamic Links using the REST API in a Cloud Function that is triggered when new content is added to the Firestore, would these links persist?
I know that using the long Dynamic Link format will give me what I need, as I can create the short URL with the param added. But this doesn't solve the issue of giving the Copy Writers a URL structure that is easy to use in their content. Maybe a Cloud Function that strips out the URL links from the body copy, and replaces it with the long-form Dynamic Link?

wordpress: change the core table structure for ecommerce site

i have project that i need to integrate tables in different structure of wordpress. i am want to use woocommerce plugin and make it work with product table. i still want to preserve all woocommerce logic and features.
when thinking about that all i want to do is changing the way i want to get the data, i mean to the query. my question is, if there is a way to implement it with kind of service.
i thought about serviece with functionality:
1.disable the post meta request- i am still trying to figure out how to do it.
2.trigger hooks once before the request to DB trigger - this is where i will convert the query wordpress/woocommerce logic created to new structure that will fit my tables structure.
3.trigger hook once after i get response from request where i will convert it to structure worpdress/woocommerce need for using the original flow.
how much it will be complicated and which hooks or filters should i use.

WordPress: Can I batch upload lots of files (e.g. via a custom field) which will appear on my website as a list of downloadable files?

TL;DR: Can I upload hundreds of files via WordPress (vanilla or with free/premium plugins) which will appear on my website as downloadable files, or would another CMS be better suited to this task?
More info: I'm building a site to replace an old WordPress MU site. My (non-technical) client needs to be able to create a single profile page for each of their employees. Each employee page must include some or all of:
A header image
A text intro
A photo gallery
A list of links
Multiple audio embeds
Multiple video embeds
A list of ~1000 downloadable files, mostly pdf/jpg, divided into subgroups
Ideally the last point would be achieved something like this:
Client adds a custom field and must name it
Client drags any number (realistically 1-100) of files onto the field, or uploads via "add files" function
Files are saved in the backend to a folder named after the custom field
File order is editable by client
The field is output to the HTML page like this:
<h1>Custom Field Name</h1>
<ul>
<li><a>file1.pdf</a></li>
<li><a>file2.jpg</a></li>
...~100
</ul>
Employee A is totally separate from Employee B, C, etc. All employees' pages will be managed by a single user. Their files should exist separately in the backend. The paths to their files will ideally include their name, but only the filename itself needs to be printed to the page. A file system like this would be perfect:
/EmployeeFirstName-EmployeeLastName/Media/YYYY/Filename.xxx
I believe WP's default media file save directories can be customised via plugins.
I'm trying to do this in WP because it's what I've used in the past and it's what my client is familiar with. A friend recommended the Advanced Custom Fields plugin for WP, which I am looking into. I'm an experienced designer but a beginner developer. I accept my naïveté and I'm keen to learn.
Possible structures:
A single WP install with a Page per employee
A Multisite WP install with a Site per employee
Other?
After much searching I'm beginning to think WP might not be a suitable platform for long and busy pages (~80 video embeds per page, added via ACF) with this type of file management requirement. The admin page for my test page is already very slow to update and I haven't even started the file list part.
Since the key feature of this page template will be the ability to list hundreds of downloadable files, it seems logical to me to pick a CMS based on that requirement, rather than pick a familiar CMS and try to force it to do what I want.
Thanks for reading!
I have used
Download Attachments plugin which provide facilities to upload attachment as post meta from admin panel and user can download it from front end. Try it might help you.

Two different users accessing same Wordpress page but have different views of a d3 object in that page

This is a question regarding data driven documents (d3 for short) and Wordpress:
I wonder if it would be possible to create a WordPress page that contains a d3 object (say a bar chart) and allow two different users of the same WordPress site to access that particular page, but view the d3 object modulo their own data. I thought for some workarounds like creating for each user a dedicated page and link the page with his/her data but that would scale to a nightmare if you have a lot of users and a lot of such pages for each one of them. I wish you could give me some ideas or feedback. Thanks !
Yes, but you'll have to modify the Wordpress template of that page to 'send' the user-id (or name) to the webpage. For that see Send wordpress $current_user->ID from php file to external Javascript file. You can then use that user-id to load the correct csv-file which can then be used generate your graph.

Resources