-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Result 1 must be a single string, not NULL of length 0 #31
Comments
Here is my code (I call the index.Rmd file via render in a normal R script): Normal R-script: `
index.Rmd script: `---
|
Btw the plotly plot is compiled to the /figs folder in html via: library(plotly) fig <- plot_ly( withr::with_dir('C:/Users/Me/Documents/WordPress/UploadWP/figs', saveWidget(fig, file="test.html")) |
Btw I did see the following when I previewed the post which is different between when a .png vs an .html is added: When right click on the .png file and opened in a new window, the .png image loaction is at: https://www.myWPwebsite.nl/wp-content/uploads/2021/04/test.png....which is correct But the .html is at (which is btw not visisble in the post but it there appears as an "unknown image icon": https://www.myWPwebsite.nl/fig/test.html...so this is clearly a wrong location However the real test.html btw is uploaded to the media library at https://www.myWPwebsite.nl/wp-content/uploads/2021/04/test.html |
Thanks @HugoGit39! I didn't manage to look into it yet but I guess it's because of the logic here: In short, I suppose @maelle only wanted to upload static images not interactive ones like generated from plotly. @HugoGit39 do you want to improve the logic and make a PR? |
yes I didn't have images that are not in an image tag in mind, indeed. A PR would be interesting @HugoGit39 |
@maelle so you mean only media files which wordpress recognize as images (which are .jpg .jpeg .png .gif) work in the current goodpress package? |
Honestly Im a bit fed up with the combination of R and WordPress....moreover your code @maelle is pretty difficult for me to comprehend so I will possibly try but probably not unfortunatly |
I understand! It's an unfortunate situation as I do not have the bandwitdth to work on goodpress right now. I hope you can find a workaround, good luck! |
this seems to be the right direction: https://bhaskarvk.github.io/widgetframe/ |
I might have found a solution though Im stuck at 1 thing: If I add the plotly plot in Rmarkdown its embedded in the html output perfectly....so in my view, if I add this html file output in the content-variable 'content', it should upload it as a post (right?)....and when I have the post id I can just re-run Rmarkdown so the html ouptut gets overwritten as a new, updated post However how do I add the html output from Rmarkdown as the conten variable? Ive dismantled the code a bit, see: So first run Rmarkdown with a plotly plot:
Than put in body tags:
Than call the .wp_post function with wp_call_api included with wordpress_url = www.yoursite.com en post_id = the id of the post
|
Hi Im running at the following issue constantly wile producing a post with a html plot made via plotly
Even if I have a simple Rmarkdown file with just 1 plotly html plt attached via knitr::include_graphics(file.path("figs", "test.html"))
Error:
Run
rlang::last_trace()
to see the full context.The text was updated successfully, but these errors were encountered: