• Good afternoon,

    This plugin is REALLY usefull for portfolio website! I gave it 5 star rating.

    One question though. I wanted to use this in my functions.php to auto load some text in de post:

    // Default post editor text //
    
    function diww_default_post_content( $content ) {
    	$content = '<ul class="details">
    <li>Jaar:</li>
    <li>Afmeting b x h:</li>
    <li>Techniek: </li>
    <li>Prijs:</li>
    <li>Beschikbaar: Ja (<a href="mailto:[email protected]">stuur een e-mail</a>)</li>
    </ul>';
    	return $content;
    }
    
    add_filter( 'default_content', 'diww_default_post_content' );

    But this is not visible in the post your plugin makes. I tried this but it did not work:

    // post editor text //
    
    function afip_new_post_content ( $new_post_content ) {
    $new_post_content = '<p>test</p>';
    return $new_post_content;
    }
    
    add_filter( 'afip_new_post_content', '', $post_id );

    Can you help me?

    Kind regards Willem

    https://www.ads-software.com/extend/plugins/automatic-featured-image-posts/

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

    (@jeremyfelt)

    Both examples are close, but a little tweaking is needed.

    The filter you are trying to use is afip_new_post_content, so that will always be the first argument for add_filter(). The second argument should be the function you are using to handle the content, in this case diww_default_post_content(). The third argument is for priority, and the fourth for number of arguments to pass to the filter.

    In this case, you are replacing the content entirely rather than appending, so you can probably leave out the third and fourth arguments.

    Try this:

    // Default post editor text
    function diww_default_post_content() {
        $content = '<ul class="details">
            <li>Jaar:</li>
            <li>Afmeting b x h:</li>
            <li>Techniek: </li>
            <li>Prijs:</li>
            <li>Beschikbaar: Ja (<a href="mailto:[email protected]">stuur een e-mail</a>)</li>
        </ul>';
        return $content;
    }
    add_filter( 'afip_new_post_content', 'diww_default_post_content' );

    For more information on the arguments used with add_filter(), check out the Codex article.

    Thread Starter Willem-Siebe

    (@siebje)

    You’re the man! Thanks for the effort!

    Plugin Author Jeremy Felt

    (@jeremyfelt)

    Marking this as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Automatic Featured Image Posts] Auto text’ is closed to new replies.