Title: [Plugin: AddQuicktag] Is caption adding possible?
Last modified: August 19, 2016

---

# [Plugin: AddQuicktag] Is caption adding possible?

 *  [acub](https://wordpress.org/support/users/acub/)
 * (@acub)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-addquicktag-is-caption-adding-possible/)
 * I was wondering if there was a way to add a caption button that would ask for
   three things:
    1. {link} = location of image file 2. {title} = title of image
   file 3. {align} = alignment (left|right|center|none)
 * with these params it should output:
    `[caption caption="{title}" width="200" 
   align="align{align}"]<a href="{link}" title="{title}"><img src="{link}" width
   ="200" alt="{title}" /></a>[/caption]`
 * of course, for complete functionality it should also ask for width, but since
   i want all my captions 200px, i don’t really need that.
 * Now would that be possible?
    I know it cannot be done with your plugin as is.
   I was wondering how the quicktags.js would look for such a button…
 * [http://wordpress.org/extend/plugins/addquicktag/](http://wordpress.org/extend/plugins/addquicktag/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [acub](https://wordpress.org/support/users/acub/)
 * (@acub)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-addquicktag-is-caption-adding-possible/#post-1214103)
 * in case anyone else needs this: i’ve solved it.
    because i didn’t need both [
   img] and [caption] image, i just modified quicktags.dev.js like this (around 
   line 379):
 *     ```
       function edInsertImage(myField) {
       	var myUrl = prompt('quicktagsL10n.enterImageURL', 'http://');
       	if (( myUrl !== 'http://') && ( myUrl !== null)) {
       		var myTitle = prompt('quicktagsL10n.enterImageDescription', '');
       		var myAlign = prompt('Insert image alignment\n( left | right | center | none )', 'left');
       		myValue = ' [caption width="200" align="align'
       				+ myAlign
       				+ '" caption="'
       				+ myTitle
       				+ '"]<a href="'
       				+ myUrl
       				+ '" title="'
       				+ myTitle
       				+ '"><img src="'
       				+ myUrl
       				+ '" width="200" alt="'
       				+ myTitle
       				+ '" /></a>[/caption] ';
       		edInsertContent(myField, myValue);
       	}
       }
       ```
   
 * Of course, would have been nicer to have 4 radio-buttons for selecting the alignment,
   but since I’m not much of a programmer and couldn’t find a proper example, they’ll
   just have to type in the alignment. It’s way better than having them type the
   caption/a/img list of commands.
    This is for users who really don’t know their
   way around HTML.
 * If anyone has a better idea of how to do this in a more elegant way (plugin-like,
   so it stands to WP upgrades) I’d be quite happy to hear about it.
 * Cheers.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: AddQuicktag] Is caption adding possible?’ is closed to new replies.

## Tags

 * [quicktags.js](https://wordpress.org/support/topic-tag/quicktags-js/)

 * 1 reply
 * 1 participant
 * Last reply from: [acub](https://wordpress.org/support/users/acub/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-addquicktag-is-caption-adding-possible/#post-1214103)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
