I'm writing an AngularJS/Express/NodeJS/MongoDB website. Within this website, on the navigation bar, there's a section called "Blog", another section called "Advice articles". I intended to use Wordpress to publish the blog and publishing articles on my site, due to its outstanding ability as a blogging and CMS platform. My question is how to properly integrate Wordpress into AngularJS/Express/MongoDB system? I have come across articles on how to include AngularJS as a Wordpress subpages, but I haven't seen any articles on how to include Wordpress as an AngularJS subpage. Does anyone here know any tips/pointers/articles on such a strategy ?
My current strategy is :
Let AngularJS routing service handle the route to "Blog" section.
"Blog" section is template, which includes an iframe, that points to the Wordpress site, sth like this :
<div>
<iframe frameborder="0" height="800" width="1200" scrolling="no" ng-src="http://localhost/wordpress/?page_id=4"></iframe></div>
I can display the blog by this strategy. But it still a little bit off, I have to do some manual CSS. Is there a better way to do this out there ?
Also since I want to allow the user to comment on page without asking them to log in again. How do I integrate the login done in Express/MongoDB with Wordpress user login, which is a PHP/MySql system. Are there any article out there that shows how to implement this ?
Thanks in advance,
P.S : I do not want to go the route of rewriting my site as a Wordpress plugin, I and my friends want to maintain AngularJS/Express/Node/MongoDb as our primary MVC stack.
My advise is make wordpress API with wordpress plugin, and build commincation angularJS and wordpress through JSON api , read this article
Related
I will try to be clear but if you need more information please do not hesitate.
A site approached me to make a partnership together. They want to create a new section on their site, say a "blog" section. The goal is to post my blog post on their site, in this new section, without having access to their admin.
So I need to set up something to be able to automatically share the content I post on my site with their site. My site is on Wordpress and their site is on Drupal.
For now I see 2 possibilities, but tell me what you think and if there is better to do.
First possibility: Create the page /blog and all the articles (ex: /blog/article-title) on my site, then set up a reverse proxy to redirect their request to my server. I have no experience with network setup so maybe I am completely wrong. But even if it works, I don't know how to fetch only post content (not header, footer) and change all urls.
Second possibility: Create a Drupal module, which they will have to install on their site, which creates the page /blog and the custom content type named "blog" when it is activated. And then use the feeds module to get the content from my wordpress feed and create a blog post for each post in the feed. With this solution, I won't have any header or footer problem, and the urls to the articles will be generated dynamically.
Every advice will be usefull. Thank you.
IMO, the easiest way to do that is to use the Wordpress REST API.
You could get all posts with this https://yoursite.com/wp-json/wp/v2/posts and get a specific post with https://yoursite.com/wp-json/wp/v2/posts/:id
full doc here : https://developer.wordpress.org/rest-api/reference/
I would advise you to use the second possibility, cause there are already several drupal moduls in the wild the read and import feeds from other sites.
Even more, WordPress will provide your posts also in oembed-format. With this you can use this Drupal Modul: https://www.drupal.org/project/soembed
You vcan adjust this modul to allow content from your website and display it on the Drupal installation.
I have found multiple postings with similar phrases but all too specific to their issue and not addressing this...
Most of the website requires a login session. I have built a custom plugin for WordPress to handle my CMS needs, etc. I have included a blog in the website. However, my issue is... How do I require login when "blog" is selected on the menu. AND I do NOT want to show WordPress anything. I want the blog to look like the rest of the site.
Basically I want to "nest" the blog in my website with one required login session. I have the menu item "blog" set as a category so as to pull the WordPress pre-built functionality. So this is the only item I am not able to php a login session as there really isn't a page to do so.
I have read several things. But finding them a bit confusing. Many say to change the wp-config.php but I am not comfortable with changing core files within WordPress. What am I missing or misunderstanding?
UPDATE:
Would changing the menu selection to a "page" instead of "category" and insert php file within that page with a redirect using header('Location:mysite.com/blog_files (of course after session verified) to redirect where WordPress has stored my blog? Is this a viable work-a-round?
You can use your wordpress as API point. Wordpress comes with REST API. So what you can do is get all posts after certain action. Then parse them in html.
There are 2 things to keep on mind.
1st is that everything on wordpress is post.
2nd is that to change certain parts of how api works you add filters to functions.php.
Hope I was helpful.
UPDATE
I have successfully "nested" my blog into my website so that login session is required. Changing the menu selection to a "page" instead of "category" and insert php file within that page with a redirect using header('Location:mysite.com/blog_files (of course after session verified) to redirect where WordPress has stored my blog files. This was quick and easy. However, it still requires WP login to participate in the blog. :(
I am new to using Wordpress as a developer as opposed to just using the dashbord but am struggling to understand a few things and would really appreciate some help.
For a site that does not require a blog - do you just create custom/specific page templates for each page that your site requires?
If so - presumably you code the content directly. But then how does the client edit their website's about page or any other page for example - because doing it through the dashboard isn't going to use the necessary CSS hooks without using classes, id's and HTML?
As a beginner to Wordpress - I can't see that posts are used on sites that don't have a blog, but am I correct or is using posts the way a client can edit content on their site, but just have posts styled to look like normal content?
Or am I wrong in thinking a company (I am starting as an intern at a web dev company that use WordPress) provides the tools or at least configures WordPress to enable the client to change content?
Any help getting me to understand the basic concept and way a developer would create a custom WordPress site would be much appreciated. Thanks in advance.
You can use page.php. In WordPress everyone create at least one custom template type to get wider design for custom pages.
You can refer here for more info.
Use Advanced Custom Fields with page templates. Say you are making an About page, call that template about and select that template in the backend editor. Once you save the page, the acf fields will show up and you can populate the content.
ACF: https://www.advancedcustomfields.com/
Page Templates: https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
Our Website url structure is something like this :- www.example.com/website/xyz.htm
Our Website cached in Google something like this :- www.example.com/page/1 to www.example.com/page/32 but when i open this url, it's pointing me to the home page. We have used Wordpress CMS.
We have not created these things in our website. We do not understand, how it happened.
Thanks
Rob
I thought you might have used a plugin for getting WP SEF url for your WP pages to appear as HTML pages. Use some other latest , compatible and popular plugin to convert WP pages as HTML pages.
Google sometimes does not understand your site perfectly at all time due to the modification you done in your site.
So create an account in google analytics and verify it with your site then remove all listed pages and rebuild it once again by submitting new sitemap
Use Wordpress Yoast SEO Plugin. This will give you the functionality to remove the caching in Google Search.
After disabled the /page/option, you need to resubmit the sitemap xml in Google Search Console.
I found a article on the atk4 blog http://agiletoolkit.org/blog/integrating-agile-toolkit-with-wordpress/ I followed the instructions and i get a error and it says the ApiWeb Class not found. Then I looked in index.php on the real framework that you download and it initializes everything differently then the blog post did so. I'm wondering if ATK4 can be integrated or maybe I'm doing something wrong?
I'm also currently integrating a wordpress site with ATK4 at the moment.
The ApiWeb.php class is present in the atk4/lib directory in both 4.2 and 4.1.3 versions of atk4 so not sure why you are getting an error.
What is suggested on the blog page about integrating ATK4 with wordpress is that you would load the ATK4 libraries as php embedded in the pages so you would need to ensure you change the include line based on where you have placed the atk4 files.
<?php
include 'atk4/loader.php';
$api=new ApiWeb('sample_project');
$api->add('jUI');
.. .. ..
$api->execute();
?>
I havent tried this but think you would need to verify the path to ATK4 is correct.
I've taken a different approach to integrating Wordpress and ATK4 - rather than embedding ATK4 into the pages as per the blog article you referenced, i'm going with installing wordpress in one installation and ATK4 in a separate one and using the same template in both.
The wordpress template i'm using is from themeforest and it came with a WP folder containing the Wordpress files plus a HTML folder that contains example pages. I took one of the HTML pages and created a new templates/default/shared.html inserting the atk4 tags such as in the appropriate places.
I've created a menu in Wordpress Theme->xxx->Menu which are mostly static pages from Wordpress and one menu option which is a link to the start of the ATK4 root. Because i'm using the same template, it looks like a single site. In my case, i'm not using the login functionality of Wordpress - all the wordpress pages will be accessible without logging in but i am using a dynamic second level menu and options based on the logged in user which will be defined in Frontend.php
The ATK4 menu gave me a problem because it wasnt consistent with the site and after a while trying to style the menus with CSS and create a submenu using Menu_Basic and Menu_Lite, i went with using ATK4 Views and split the HTML from the wordpress theme, to create a menu.html, a submenu.html and a menuitem.html and have set this using code in Frontend.php
It's still a work in progress so i can't provide the link at the moment as it's not online yet but it seems to be working and may give you other ideas depending on what you want to achieve with integrating ATK4 and Wordpress.
If you want to have a common login for ATK4 and Wordpress (using ATK4 to control the access each user has), there is a plugin for Wordpress that might help with external DB Auth so you could use this with the BasicAuth of ATK4 instead of using Wordpress Auth functionality.