logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
Prefilled Post in Wordpress

Good day to all,

I created my Wordpress "blog" as a method of keeping track of structures for me in my courses. I would like to have it where when I click on "New Post" that the following content is already in the post
<h3>AKA</h3>
<p>N/A</p>
<h3>Code</h3>
<p>N/A</p>
<h3>Function</h3>
<p>N/A</p>
<h3>Afferent</h3>
<p>N/A</p>
<h3>Efferent</h3>
<p>N/A</p>
<h3>Definition</h3>
<p>N/A</p>
<h3>Interesting Notes</h3>
<p>N/A</p>
<h3>Images</h3>
<p>Add images here</p>


Here is a video demonstrating what I am attempting to do (can be viewed in HD).


http://youtu.be/72RLi8cz3R8


Thanks to anyone with ideas.

missionman | 12/15/11 at 8:09pm Edit
Tutorial: How to assign prize money

Previous versions of this question: 12/15/11 at 8:10pm | 12/15/11 at 8:11pm

(5) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    12/15/11
    8:15pm
    Maor Barazany says:

    add_filter( 'default_content', 'tc_default_content' );
    function tc_default_contentt($content) {


    $default = '<h3>AKA</h3>
    <p>N/A</p>
    <h3>Code</h3>. ......etc
    ';
    return $default;
    }

    Previous versions of this answer: 12/15/11 at 8:15pm

    • 12/15/11 8:15pm

      Maor Barazany says:

      I've forgot to write, put this snippet in your theme's functions.php file

  • avatar
    Last edited:
    12/15/11
    8:15pm
    Manoj Raj says:

    paste this is functions.php

    add_filter( 'default_content', 'my_editor_content' );
    function my_editor_content( $content ) {
    $content = "<h3>AKA</h3>

    <p>N/A</p>

    <h3>Code</h3>

    <p>N/A</p>

    <h3>Function</h3>

    <p>N/A</p>

    <h3>Afferent</h3>

    <p>N/A</p>

    <h3>Efferent</h3>

    <p>N/A</p>

    <h3>Definition</h3>

    <p>N/A</p>

    <h3>Interesting Notes</h3>

    <p>N/A</p>

    <h3>Images</h3>

    <p>Add images here</p>";
    return $content;
    }

  • avatar
    Last edited:
    12/15/11
    8:19pm
  • avatar
    Last edited:
    12/16/11
    1:34am
    Julio Potier says:

    Hello

    i understand you need and the 3 answers before me are right.

    But if i analyse you question, i can tell you this :
    A day you will need to change your theme and maybe that the actual structure <h3>...</h3><p>...</p>... won't be the correst struture you need.
    Maybe you will need to list with <ul><li> or <div><span> or other tags.
    Or a day you will need to translate the title, or you will need to change the order of entries, or need to add a new entry...

    And this day, you'll want to die because all of your posts must be reworked.
    See what i mean ?
    I tell you this because i made this mistake ...

    And the best solution is to use the post meta.
    I suggest you to create as many as meta you want, in any order.
    Then in your single.php template you can grab all meta datas, print them in any order, any language, any format.
    (And do not forget to add a filter to the_exerpt for RSS)

    VoilĂ  !

    I can do this of course, but not for $5. I think it can be done in about 1h. Contact me if you want me to do this.

    See you !

    • 12/17/11 5:39pm

      missionman says:

      I'm intrigued by this suggestion of yours. If I am correct the previous methods will work, however it will do so for every post I have already created. Is that correct?

      The method you describe would not do this. If possible, could you elaborate on the advantages and disadvantages of the method you propose and state your cost, I'm willing to invest in my site since I use it so often

    • 12/17/11 6:15pm

      Julio Potier says:

      Ok, i'll do this tomorrow ;)

    • 12/18/11 3:31pm

      Julio Potier says:

      OK so with my solution :

      +++ are :
      - Very flexible : you can remove, add, change order of entries (an "entry" for me is like AKA, Code...)
      - You can change the CSS easily
      - You can change your theme easily
      - You can change your page/post template easily
      - You can build your own excerpt for website and/or RSS feed based on your entries
      - You can use different templates for cat or page or archives etc with same datas/entries
      - You can query posts using your entries in where clauses !
      - You don't have to use the solutions above, just use a page/post template

      --- are :
      - You have to modify your old posts before using this system ( +++ but never need to modify later ;))

      With the other solutions, if you need to change your css, theme, template : YOU CAN NOT
      Or each time your want, you'll have to modify again all your posts.

      See you soon (ps you can PM me ;) )

  • avatar
    Last edited:
    12/16/11
    2:48am
    Francisco Javier Carazo Gil says:

    You can also make your own plugin in order to activate or deactivate it. You create a file called "mydefaultplugin.php" in "/wp-content/plugins/" and paste this code:


    <?php
    /* Plugin Name: MyDefaultContent
    Plugin URI: http://your_url.com/plugin
    Description: Turn
    Version: 1.0
    Author: The WP Questions Experts
    Author URI: http://www.wpquestions.com
    License: GPLv3 */

    add_filter( 'default_content', 'my_editor_content' );

    function my_editor_content( $content ) {
    $content = "<h3>AKA</h3>
    <p>N/A</p>

    <h3>Code</h3>
    <p>N/A</p>

    <h3>Function</h3>
    <p>N/A</p>

    <h3>Afferent</h3>
    <p>N/A</p>

    <h3>Efferent</h3>
    <p>N/A</p>

    <h3>Definition</h3>
    <p>N/A</p>

    <h3>Interesting Notes</h3>
    <p>N/A</p>

    <h3>Images</h3>
    <p>Add images here</p>";

    return $content;
    }
    ?>


    Hope it helps!

This question has expired.





Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.