Forked from brendandawes/ifttt-instagram-to-blog.php
Last active
July 21, 2017 06:59
-
-
Save bastianallgeier/ba38bfe424a4c94fa33cb70e50f820ec to your computer and use it in GitHub Desktop.
IFTTT Make channel action to create blog post from new post on Instagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* if this script is located in your document root… */ | |
require(__DIR__ . '/kirby/bootstrap.php'); | |
if(get('params')) { | |
$articles = page('blog')->children(); | |
$sort = ($articles->count() + 1); | |
$date = date('Y-m-d'); | |
$dirname = $date . '-' . $sort; | |
$article = $articles->create($dirname, 'article', [ | |
'title' => get('caption'), | |
'date' => $date, | |
'text' => get('params'), | |
'blogid' => $sort, | |
]); | |
$article->sort($sort); | |
} |
Tried to get the url of the created post by doing $article->url() but weirdly it returns the url of the script?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant. Had no idea Kirby could create articles like that.