if (!require('knitr')) {
install.packages("knitr")
}
if (!require('devtools')) {
install.packages("devtools")
}
if (!require('RWordPress')) {
devtools::install_github(c("duncantl/XMLRPC", "duncantl/RWordPress"))
}
#activate the necessary libraries
library(flexdashboard)
library(RWordPress)
library(knitr)
library(XMLRPC)
library(reshape2)
library(RCurl)
options(WordpressLogin=c(your_own_user_name='your_password'),
WordpressURL='https://yourwordpressaddress.com/xmlrpc.php')
opts_knit$set(upload.fun = imgur_upload, base.url = NULL) # upload all images to imgur.com
knitr::opts_chunk$set(
echo = TRUE,
fig.height = 5,
fig.width = 5,
cache = TRUE
)When you create a new post, a ‘post id’ is automatically generated. This ‘post id’ will be required as an argument when you edit your post.
---
title: "Use the RWordPress package to write blogs on Wordpress"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
social: menu
source_code: embed
---
### Required packages and functions to connect to Wordpress
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE}
if (!require('knitr')) {
install.packages("knitr")
}
if (!require('devtools')) {
install.packages("devtools")
}
if (!require('RWordPress')) {
devtools::install_github(c("duncantl/XMLRPC", "duncantl/RWordPress"))
}
#activate the necessary libraries
library(flexdashboard)
library(RWordPress)
library(knitr)
library(XMLRPC)
library(reshape2)
library(RCurl)
options(WordpressLogin=c(your_own_user_name='your_password'),
WordpressURL='https://yourwordpressaddress.com/xmlrpc.php')
opts_knit$set(upload.fun = imgur_upload, base.url = NULL) # upload all images to imgur.com
knitr::opts_chunk$set(
echo = TRUE,
fig.height = 5,
fig.width = 5,
cache = TRUE
)
```
### Write a new post
When you create a new post, a 'post id' is automatically generated. This 'post id' will be required as an argument when you edit your post.
```{r echo=TRUE, paged.print=TRUE}
#knit2wp(input='post.RMD', title = 'RWordPress Package',post=FALSE,action = "newPost")
```
### Edit your post
```{r echo=TRUE}
#knit2wp(input='post.RMD', title = 'RWordPress Package',post=FALSE,action = "editPost",postid=102)
```
### End