• Hello,

    I would like to have my quicktags work when I select a part of the page title or the post title.
    I have search but everyone is interested in quicktags whitch permit to write title=”” in a link and not my wish.

    I’m dum in javascript as in php as in football, and I don’t know what I must change in quicktags.js.

    Someone can help ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter hapaxlegomen

    (@hapaxlegomen)

    My question is so stupid ??… I don’t think it’s so easy, and no one speak about it !

    More than 90% of my titles must have italic (book titles) and so if Quicktags could work for them, I could win lot of time instead copy-paste every tag by hand.

    If there is a javascript senior, let him explain ??

    It’s not stupid just very unique and unless I am mistaken, not very useful to many besides you personally. Someone will probably get to your question in time, just not right away. You can certainly hack the core files to do this, emulating what is done for the post content.

    Not too sure what you’re trying to do but start here:
    https://tamba2.org.uk/wordpress/quicktags/

    Also search the forum for quicktags.js for lots of other threads.

    Trying trying to set up quicktags in the title of the post, not just in the post content.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    I have already hack the quicktags.js but I simply cannot find where to hack the “destination” of tag generatef by a quicktag.

    I don’t think it’s interesting only me. In fact, I don’t understand why quicktags are limited to the post content. More is better than less for the same price, isn’t it ? (I say that for next version of WP)

    i don’t understand what you mean… you want the post title to appear in italics? so you want your title of post to wrap Title ? so you want to target that text field.

    i would recommend a use of CSS instead, then you won’t have to fiddle when you upgrade. i think it’s more sematically correct too.

    for example, you say 90% of your posts are books, and need italics for titles. i assume you’re using a category called “books”, and we’ll pretend there’s a category called “other”

    you can tag your post title with the category… in this example, the title is an h3

    <h3 class="<?php the_category(' ') ?>"> whatever title code </h3>

    then in your CSS you can have a special class:

    h3.books {
    font-style: italic;
    }

    other category titles will appear as normal!

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Thanks but I can do this. Only part of the title post must be in italic… I need quicktags to target the title field.

    ah- ok.

    well. i’m stuck then. i can see what is controlling the selection of the ‘content’ area.

    in the HTML of wp-admin i see the text area id ID’d ‘content’:
    <textarea rows="9" cols="40" name="content" tabindex="4" id="content"></textarea

    and then referred to in embedded javascript:
    edCanvas = document.getElementById('content');

    the title area is ID’d ‘title’:
    <input type="text" name="post_title" size="30" tabindex="1" value="" id="title" />

    but if you changed the edCanvas to ‘title’ it won’t work for ‘content’ – i’m stumped.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    You’re right. I have try. 2 content id is not working.
    Thankx a lot anyway for your help on all my topics (:-)).

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    I absolutely need this functionnality. No one knows the javascript trick for that ? :-O

    any luck so far?

    i stilll don’t have your answer… but some ideas for figuring it out.

    1. try changing the value and testing it.
    did you try changing the value of the edCanvas to see if it works?
    edCanvas = document.getElementById('title');

    2. try making a function and testing it.
    since it is using getElementBy and sending in a value, there must be someway to have some kind of onclick action to send the value as a variable: through a function in javascript. something like:

    function edCanvasvalue (id) {
    edCanvas = document.getElementById(id);
    }

    then call the javascript function… try testing it with buttons first

    <input type="button" value="Set to title field" onclick="edCanvasvalue('title')">
    <input type="button" value="Set to content field" onclick="edCanvasvalue('content')">

    then try filling in the form, and see if it set the right fields.

    3. try setting the the ID with a getFocus() from form field. this is where i’m a bit unsure…

    i’m just making this up, bc i don’t know much javascript.

    and hopefully there might be javascript-specific fora to find the answer from others:
    try: https://www.codingforums.com/

    that’s alll not very helpful probably, but i wanted to post it in case you had not thought of trying those things?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How use quicktags in other admin fields ?’ is closed to new replies.