Giter Site home page Giter Site logo

david2701 / wordpress-rest-admin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rnaga/wordpress-rest-admin

0.0 0.0 0.0 669 KB

A frontend for admin area of WordPress, using WP REST API and React. It works with Self-Hosted WordPress

License: MIT License

HTML 0.67% CSS 11.99% JavaScript 87.34%

wordpress-rest-admin's Introduction

WordPress REST Admin

A frontend for admin area of WordPress, using WP REST API and React. It works with Self-Hosted WordPress.

Alt Screenshot

This project was bootstrapped with Create React App.

Features

  • Login (using JWT WP REST Plugin)
  • Dashboard
  • Posts(List, Edit, Add New, Trash)
  • Pages(List, Edit, Add New, Trash)
  • Media Upload(Images)
  • Categories and Tags
  • Comments
  • Users
  • Profile
  • Settings
  • Code generator to create your own page

Usage

Backend - what needs to be done first

Make sure you have WP REST API and JWP plugin installed in your wordpress

WP REST API

JWP Authentication for WP REST API

git clone and npm start

  • Run these commands just to see how it works
git clone https://github.com/rnaga/wordpress-rest-admin.git .
npm install
npm start

Use as a React Component

cd /path/to/your/project
npm install
npm i wordpress-rest-admin
  • and render it
import WPAdmin from 'wordpress-rest-admin/WPAdmin';
import contents from 'wordpress-rest-admin/contents';
import loginLogo from './WordpressLogo.svg';
import headerLogo from './WordpressLogo.png';

...

<WPAdmin
  loginLogo={loginLogo}
  headerLogo={headerLogo}
  defaultContent={defaultContent}
  contents={contents}
/>

See example here

How to create your own page

npm install yo -g
  • clone this repo, and install generator (generator-wordpress-rest-admin)
git clone https://github.com/rnaga/wordpress-rest-admin.git . 
cd ./generator
npm link

There is "generator" directory in this repo. Go under the directory, then run "npm link" as above

  • Go to "src" directory under your React project, and run yo command (Choose your icon from here)
yo wordpress-rest-admin:contents [mypage]

It creates new files(components) under "contents" directory (see blow)

Alt Screenshot

  • Import and pass your new page to WPAdmin component
import mypage from './contents/mypage';

....

<WPAdmin contents={{mypage}} />

Alt Screenshot

  • Update components(List.js, Edit.js and Create.js) as needed to change output

How to import existing pages into your project

This is useful in case you want to modify existing pages

yo wordpress-rest-admin:contents --copy-from=[content]

where "content" is one of the following.

categories  comments  dashboard  pages  posts  media profile  settings  tags  users

See example here

Supported Browsers

By default, the generated project uses the latest version of React.

You can refer to the React documentation for more information about supported browsers.

wordpress-rest-admin's People

Contributors

rnaga avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.