Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other WordPress -add default text to post category description in admin

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #33731
    JapaneseDear
    Member

    Hi guys,

    do you know if it is there any way how to add default text into the post category description textarea in wordpress admin?

    Thank you for help!

    #84291
    shazdeh
    Member

    There’s no hooks to do that. But you can edit the admin file if you really need to do this. Open up wp-admin/edit-tags.php on line 356, you see this:

    Or, you could add some jQuery to the page that removes that textarea and replaces it with with your own (but it must have the same name.)

    #84292
    JapaneseDear
    Member

    Thanks for tip, I will try it.

    But how some plugins work without that hook? For instance, Rich Text Tags, Categories, and Taxonomies.

    My main goal, is to make this category descriptions easy editable for my client, but I need some way how to do it compatible with qTranslate, to support 2 language versions.

    I wanted to output there at least the language tags. But maybe there is some way how to embed normal wordpress editor, one that we use to edit posts, pages and stuff.

    #84296
    shazdeh
    Member

    Could you provide the links for those plugins? I’m interested to check the sources!
    What do you mean output language tags? What do you wanna do?

    #84297
    JapaneseDear
    Member

    http://wordpress.org/extend/plugins/rich-text-tags/

    I use qTranslate to have site in two languages. When i put this code to category description:

    English text Slovak text

    it will create two language versions of category description, and they are correctly outputed to the site using

    so i wanted to put this English text Slovak text “language tags” as default content to the category description textarea, so my client can just paste his text between them for each language. But it is not very user friendly. I dont want user to see any code.

    The best thing will be to have a standard post/page wordpress wysiwyg editor for category description, because qtranslate automatically puts language tabs on top of it, so user doesn’t see any “langage tags”. Maybe I can do my really simple custom wysiwyg editor with jquery and replace default textarea…

    #84300
    shazdeh
    Member

    Does this do the trick?


    function category_description_fields() { ?>

    add_action( 'admin_head-edit-tags.php', 'category_description_fields' );

    As you know it should go in your theme’s functions file, or a plugin.

    #84303
    JapaneseDear
    Member

    Well, not really, but I altered your code that we will achieve goal of this topic.
    If I will have time I will maybe tweak this a bit, to make it more user friendly.
    Thank you very much for your help!

    To add default text do post category description, add following code to your functions.php or plugin:

    function category_description_fields() { ?>

    add_action( 'admin_head-edit-tags.php', 'category_description_fields' );
    #129726
    tazosmr
    Member

    If you want to automatically add specific text to your editor while publishing posts or pages, then:

    1) You can install Plugin: Default Post Content

    OR

    2) If you want to automatically add specific text to your editor while publishing posts or pages, then insert one of the following codes into functions.php:

    function add_before_content($content) {

    if ( ‘page’ == $post->post_type ) return $content .’Default page content.’;

    if ( ‘post’ == $post->post_type ) return $content .’Default post content.’;

    }

    add_action(‘publish_post’,add_before_content);

    add_action(‘update_post’,add_before_content);

    add_filter(‘the_content’, add_before_content);

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Other’ is closed to new topics and replies.