adjustable post_type
This commit is contained in:
parent
85ff4c0c6c
commit
f22e8199e4
@ -12,7 +12,7 @@ Module.register('MMM-Wordpress', {
|
||||
updateInterval: 600000, // 10 minutes
|
||||
url: 'YOUR_WORDPRESS_API_URL', // replace with your WordPress API endpoint
|
||||
numberOfPosts: 5, // number of posts to display
|
||||
posts: 'posts', //Endpoint ("posts" for normal posts, can be changed to custom post type)
|
||||
posts: 'posts', //Endpoint ("posts" for normal posts, can be changed to custom post type)
|
||||
},
|
||||
|
||||
start: function() {
|
||||
@ -29,7 +29,7 @@ Module.register('MMM-Wordpress', {
|
||||
const numberOfPosts = this.config.numberOfPosts;
|
||||
|
||||
//hier müssen die posts noch rein!
|
||||
this.sendSocketNotification('GET_POSTS', { url, numberOfPosts });
|
||||
this.sendSocketNotification('GET_POSTS', { url, posts, numberOfPosts });
|
||||
},
|
||||
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
|
@ -10,8 +10,8 @@ module.exports = NodeHelper.create({
|
||||
console.log('Notification!');
|
||||
if (notification === 'GET_POSTS') {
|
||||
console.log('Notification: GET_POSTS');
|
||||
const { url, numberOfPosts } = payload;
|
||||
const apiUrl = `${url}/wp-json/wp/v2/posts?per_page=${numberOfPosts}`;
|
||||
const { url, posts, numberOfPosts } = payload;
|
||||
const apiUrl = `${url}/wp-json/wp/v2/${posts}?per_page=${numberOfPosts}`;
|
||||
|
||||
request.get(apiUrl, (error, response, body) => {
|
||||
if (!error && response.statusCode == 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user