WordPress.org

Ready to get started?Download WordPress

Forums

Automatic Featured Image Posts
[resolved] Insert dynamic default content? (2 posts)

  1. jcyin
    Member
    Posted 1 year ago #

    Following up from this post http://wordpress.org/support/topic/pre-filled-post-contents?replies=2

    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?

    e.g.

    URL[0] -> Post[0]

    URL[1] -> Post[1]

    URL[2] -> Post[2]

    and so on.

    Thanks, great plugin btw. Works amazing! :)

    http://wordpress.org/extend/plugins/automatic-featured-image-posts/

  2. Jeremy Felt
    Member
    Plugin Author

    Posted 1 year ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.