create a post in Wordpress with an external script - wordpress

I am making a java script to create a few posts in a Wordpress blog by only inserting them into the wp_posts so table. So far I could browse the posts on web browser. Question is, is it good enough with the db operations ? does anyone know any other subsequent tables need to be updated for making a post ?

Not really, you can extend the default and existing WordPress posts.
But you can go ahead and create your own table like: https://github.com/wp-plugins/wordpress-guest-post/blob/master/wordpressguestpost.php

ended up adding REST API V2 plugin and make calls to it for creating all sorts of things. Worked like a champ

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.

How to consolidate 2 database calls

I'm not experienced with WordPress so please excuse me if the question is stupid.
I have a custom template page that displays record information obtained from database. This page also call get_header() to generate the header part of the page.
I want that the page title (in HEAD HTML) will display some of the record information also.
What is the best way to do this, the "WordPress way", with 1 database query?
Currently I execute 2 identical database queries: one in add_filter('wp_title', myfunc) # function.php and the other in my custom template PHP. This duplication looks wrong.
OK, figured that out... I guess I have to use global wordpress database connection ($wpdb)

In wordpress 4 need pagination plugin working with any tables

I need pagination for created my new tables in wp 4.2.
I tried to use some common plugins like
https://wordpress.org/plugins/wp-paginate/installation/
But I found that it(and some other plugins I watched) works only with post table. Could you to point to me to some good pagination plugin working with any tables ?
Thanks!
Let me to ask in other way : I need pluging not to connecting with any table, just to draw pagination pages by given parameters like n=base url, number of pages etc... Splitting of data I can make on myself. I made something like this in codeogniter 2 projects. If there is something good for this ?

WordPress Plugin Development Idea? Is this possible? Am I on the right track?

I'm very new to WP development. I host a website which needs a list of trails (hiking, biking, etc) and I'd like to write a WordPress plugin to do it.
Can someone please tell me if I'm taking the right approach, and if what I'm proposing is possible.
I'd like the site to end up with an auto-generated and filtered index at http://example.com/trail-guide, and the discrete trail info pages at http://example.com/trail-guide/trailname. This data would all be stored in a single database table holding info for each trail, with an admin page for adding, editing, and deleting entries from here.
Is a WP plugin the best way to go about doing this, or should I be looking at something else?
From the way you're describing, your best bet would be to Register A Custom Post Type. This can be done by adding to your existing theme's Functions.php file, or by creating a plugin.
If you don't plan on changing themes, my advice would be to just hardcode everything into your functions.php file. Otherwise, creating a plugin for this particular job would be the safest alternative.
Using this functionality in tandem with Custom Meta Boxes and Custom Taxonomies will allow you to keep everything organized within the Wordpress Framework with your own special data.
This means that these new posts can also be queried at any time through the standard Wordpress Loop or search box.
If you are uncomfortable with writing your own functions to extend your existing framework, you might want to look into some plugins like GD Custom Posts And Taxonomies Tools to manage your own.
Hope this helps.

Live Sorting by Custom Field in Wordpress

Im working on a wordpress powered website for a client that involves a directory of local offices. Part of their requirement is that live sorting be implemented via drop downs, so when someone selects X Office in X Area, the page dynamically loads the relevant results.
I currently have a custom post type set-up called "listing", which lists all the relevant information for that office. I then display each of those fields via the Loop.
In a perfect world, a plugin would exist that would perform the above, but I've yet to find one. The closest I've come is The custom category sorting over at Digging into Wordpress.
Any suggestions on a "easy" solution that would allow me to sort "listings" with multiple attributes?
please use the wp-smart-sort plugin for that.
With the help of this plugin you can also sort the custom field
If there is any issue after the use of this plugin then let me know
thanks

Resources