Support » Plugin: Automatic Featured Image Posts » Insert dynamic default content?

  • Resolved jcyin


    Following up from this post

    I currently have this as the default content which is added to each post created by this plugin

    add_filter( 'afip_new_post_content', 'diww_default_post_content' );
    function diww_default_post_content() {
        $content = "<iframe src= ></iframe>";
        return $content;

    Currently I’m manually adding in the iframe src for each post. I currently have a php array with a list of URL’s. I would like to incrementally add a new URL to the src from my array each time a new post is created.

    Is this possible? If so does the current plugin work like a loop and allows a counter to increment? How would something like this be achieved?


    URL[0] -> Post[0]

    URL[1] -> Post[1]

    URL[2] -> Post[2]

    and so on.

    Thanks, great plugin btw. Works amazing! 🙂

Viewing 1 replies (of 1 total)
  • Plugin Author Jeremy Felt


    Hey @jcyin, glad you like the plugin.

    Automatic Featured Image Posts is hooked into add_attachment to do most of its work. While it doesn’t have its own specific loop to hook into, it is part of the greater loop that is created when uploading multiple images.

    You could probably keep track of the incrementing URL through your own variable outside of your filter in PHP or by building an array of URLs in advance and then removing one from the array each time it is used in your filter.

    Hope that helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Insert dynamic default content?’ is closed to new replies.