WordPress.org

Ready to get started?Download WordPress

Forums

Preset text in editor (3 posts)

  1. fritszol
    Member
    Posted 3 years ago #

    Hello folks, i tried this piece of code to preset some text in the editor in the functions.php:

    <?php
    
    add_filter( 'default_content', 'my_editor_content' );
    
    function my_editor_content( $content ) {
    
    	$content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";
    
    	return $content;
    }
    
    ?>

    But, when i add html code like this:

    .....
    function my_editor_content( $content ) {
    
    	$content = "<img src="" width="100%" height="100%">
    text
    <h3>Download</h3>
    <a href="" target="_blank"></a>";
    
    .....
    
    ?>

    it doesnt work. I understand why, because all the "" are fighting with eachother, but how should i write that piece of code so that it works in the editor? Now tha whole page gets white, and i have to reupload the backup php file to make my site work again.

  2. fritszol
    Member
    Posted 3 years ago #

    also, when i take away all the "", it still doesnt work.. whyy?? :(

  3. fritszol
    Member
    Posted 3 years ago #

    come on..?

Topic Closed

This topic has been closed to new replies.

About this Topic