I've set up Gatsby with Wordpress, but now I'm trying to figure out how the workflow of adding new content to the site via WP and having it show up as static markup on the server would work. Is there's a recommended way to automate the process building new WP content?
I'm guessing something like this would happen but not sure what hooks or tools already exist.
Publish a new piece of content via Wordpress on the server.
A Gatsby build kicks off. This would pull in [all] WP content and rebuild the [entire] website.
Push [move] the built static files to the web root on server
I'm also not clear on if Gatsby monitors the WP API for changes in real time or does it only do one request initially on startup?
Gatsby does not monitor WordPress. You need to set up a webhook on the WordPress side to notify your build process whenever content has changed.
Related
How would you go about hosting / deploying a React application with WordPress on the backend? I've been using the WP Rest API plugin and that API seems to need to be hosted. Would I also have to host my front-end React application on a separate server? Or would I somehow be able to put everything onto a shared hosting service like GoDaddy or GreenGeeks?
You have a handful of options. You have the power to host React and Wordpress separately, but I prefer to host mine on the same server using docker.
If your curious, check out this starter template: https://github.com/postlight/headless-wp-starter
It's one of my favorites, and it has react pre-wrapped in a docker container with straight forward instructions.
You probably has access to CPanel or similar tools to deploy your files onto server.
Reminder is to put your build files into a sub-folder rather than deploy onto server directly,
then public_html/your_project_sub_folder_name,
then you will be able to use that domain/your_project_sub_folder_name to access the reactjs
(You cannot have 2 apps deployed at the same time if they are not sub_folder separated)
At the same time, you gain original access to WP_REST to get post data in json format already, you can create your own custom end points if needed.
Here is the anwser on how to create your own custom endpoint:
Creating custom endpoints Wordpress
Yes you can host your React App and WP separately or Host it together in one.
I tried this creating React Build Files inside WP Theme. Not yet perfect but working.
This simple WP Theme with React Build files:(React Build Folder inside WP Theme).
https://github.com/jun20/Simple-WP-ReactJS-Theme-Demo
And this is the reactjs dev files:
https://github.com/jun20/wp-theme-reactjs-dev/tree/master/Final/end
although this is not production ready and not tested.
Or
You can use the Generated React JS Build Files only with the custom Routes and Endpoints from your WP Rest API.
Like in this example: (this the build files in repo Simple-WP-ReactJS-Theme-Demo)
This React JS Build folder -> https://github.com/jun20/wp-theme-reactjs-dev/tree/Final-Build/build
it has a routes and endpoints of posts, primary navigation, at pages from live wp site site.
You can put your build files (index.html, main.js, etc) into your htdocs folder or an appropriate sub-folder. You may need to change your Apache .htaccess configuration to redirect appropriate routes.
I've been asked to help out with a former colleague of mine's Wordpress Site. Nothing crazy, just change the format of a page, and add some kind of form on another page. I'm not so concerned with these changes I need to make, but am more concerned with setting up an identical site locally so that I can exercise these changes, do whatever I need to do, then simply upload my changes.
Quick background of myself; web developer of about 5 years with strengths in the Javascript frameworks and Node sphere. I know what Wordpress is and can navigate through the project with relative ease. Where I fall short is uncertainty in the project set up side of things.
So I have both the project itself and an export of my clients database, and configuration is updated accordingly. When I attempt to run the site I'm constantly prompted with errors, most of which have me take a look at the code and see what exactly the problem is. At this point I've made quite a few adjustments to the site to try and make it work that I feel continuing development won't get me anywhere.
Is duplicating an existing site to a local env usually this difficult? Could bad implementation of the initial site by the previous developer be a reason why I'm now struggling? Am I missing a step?
Duplicating a WordPress website is not that difficult. If you have the wp admin login of your website then you can simply use duplicator or akeeba backup plugin, but no worries, if you do not have the wp login access and just have the wp files & db then try this: create a new db from phpmyadmin, place your files in wp theme directory, install your new wp by using your new db file created, after that import your db file and do the following changes in your wp config file found in your root directory.
You will need to type in the new database information: database name, database user, and the password.
Once you have updated those, click Save Changes
Fixing your Permalinks
Log into your WordPress Dashboard, using the username and password from the copy of WordPress you brought over
Under Settings, click Permalinks
You don't have to make any actual changes, just click the Save Changes button.
Doing this will update all the page and post URLs. If you have custom themes or plugins/widgets with old URLs, you will have to update those manually since there are not any plugins that are able to modify those as well.
For ref:
https://my.bluehost.com/cgi/help/2361
https://www.tipsandtricks-hq.com/how-to-easily-import-or-export-any-of-your-wordpress-database-content-using-phpmyadmin-3415
I have a website built on WordPress platform. Today, when I opened the website and when I clicked anywhere on the website, adult site pages are opening up continuously.
Can anyone please suggest what could be done to resolve the issue?
Your site is hacked by someone and some script injected in your WordPress installation or database which causing to load this video your website need to scan your website using plugin like SECURI You can get this on Securi.net
Here are some solutions that you can try(Remember to take a backup before using this)
Check and clean all your recently modified files
Contact your hosting provider if you are not using dedicated server.
If you have some inactive themes and plugins which you don't need more remove them.Hackers can hide script there.
-You can upload new word-press core files which you haven't customised.
Install fresh copy of themes and plugins if you not customised them.
Change your secret keys in your wp-config file.
Check users in your word-press and delete suspected ones.
Check permission of your installation directory .if not secure them make changes.
Change you WordPress password
If this all not works to solve problem let me i will look into it.
I've created a web application based on this free Wordpress Theme:
http://vandelaydesign.com/blog/wp-themes/simple-non-profit/
All ok in localhost environment, but when I uploaded the site on remote (PHP + MySQL + Email active), the admin panel changes, and shows me only a part of whole admin menu.
e.g., admin panel doesn't show me the theme customization page and the slideshow customization page, that instead, in local environment, I have it.
Can you help me??? Thanks!
It might be that the live server is running a different version of PHP, or has config settings that make it different from your local environment.
However, my guess is that you haven't modified the database properly when you transferred it and that is the cause of your problem (I would suggest that it's nothing to do with the theme).
Moving Wordpress databases from your local development environment to live can be a massive pain because Wordpress (and lots of plugin/theme developers) use serialized arrays to store data. So if you do a find-and-replace on the database to replace your old url with the new one, you will disable lots of things like config settings and widgets (text widgets specifically, but there's loads of stuff you end up having to recreate).
Download this file;
http://interconnectit.com/124/search-and-replace-for-wordpress-databases/
and upload it to the server and access it directly in your browser. Run through the quick form and perform a serialized array-friendly find and replace on your database urls. Job done.
Delete the database on the live server and copy the local version of the database again, but this time use the instructions in the thread above to change all the instances of your local url path to the live domain url.
I have installed Job Manager plug in on my wordpress site and it is not sending emails. Its is working on one of my test server that has only Job Manager installed on it but it is not working on my client machine. There I have installed following plugins:
Exec-PHP
Flexi Quote Rotator
Gravity Forms
Hide Title
iframe
Job Manager
Linkable Title Html and Pho Widget by Penlamb
Nivo Slider WordPress Plugin
pageMash
Shortcode Exec PHP
Simple add pages or posts
Vertical Scroll recent post
Widget Context
WP-Mail-SMTP
WP Title 2
I have tried this by deactivation the WP-Mail-SMTP it does not send email then too. FYI WP-Mail-SMTP test email is going out well also when I create new users it send user information via email that means server is sending out email the issue might be with some other installed plug ins its own settings.
Have you tried disabling the rest of the plugins?
If you don't want to disable them, you can also prevent WordPress from including them for a little while. Just go to your /wp-content/plugins/ directory(through FTP client) and rename the directories of all plugins, except for Job Manager(for instance just add _ at the begining of all directories). Make sure not to go to the plugins page, until you've restored the proper directories names - otherwise WordPress will disable the plugins(whereas when the plugin files don't exist and you're not on the Plugins page, their files are simply not included). Then see if Job Manager is still not sending emails.
You can also try installing all of the plugins on your test server and disable them one by one to see if it's a plugin conflict.