DEV Community

Cover image for Dev To WordPress - A wordpress plugin to show your DEV posts
Anderson. J
Anderson. J

Posted on

Dev To WordPress - A wordpress plugin to show your DEV posts

Hello community! I've been learning some WordPress in these months and for test my knowledge untill now, I made a little widget-plugin. It shows your DEV posts in a sidebar.

GitHub logo andersonjoseph / dev-to-wordpress

A wordpress plugin to show your DEV.to posts in a widget.

dev-to-wordpress

A wordpress plugin to show your DEV.to posts.


Usage

Widget

The sidebar widget display the latest articles of the user given. You can use this widget in any widget area of your theme.

Shortcode

Use shortcodes to display a particular post. Syntax:

[devtowordpres post="https://dev.to/username/post-url-example"] 

Download

For downloads, check the latest releases. Install the .zip file from your WordPress admin panel.




DEV doesn't have an API yet, so the plugin grabs the content making requests to a hardcoded URL

This is the first thing that I done for wordpress, so contributions and feedback are totally welcome :)

Top comments (3)

Collapse
 
danku profile image
Daniel McMahon

Hey this is a cool idea and well done! I'm curious, are you somehow passing your specific accounts auth in a request to dev.to to get you're posted articles then and parsing the response to display the articles? Since there is no API I imagine this was a little awkward to workaround?

Collapse
 
andersonjoseph profile image
Anderson. J

Well, the articles are public so send auth credentials in requests isn't necessary. I'm only passing an user id and the number of posts to fetch. When I was learning some Node js, one of my first learning projects was a CLI for dev.to in that project I also used the same point for request articles, I found that point looking in the network logs of my browser. After a few days I was waiting for any error with the url (404 or something like that), but after 5 months, everything still working! So I used the same point for this, the response is in JSON with all the articles info. So it made me the things a little bit easier.
The awkward part is having that super-hard-coded url for fetch the articles. As soon we get an official API, I will update the code.

Collapse
 
andersonjoseph profile image
Anderson. J

Thanks!