The question title may be more revealing, but let me

The question title may be more revealing, but let me describe my aim better, which is to generate variable content. In particular, I want a single template to serve as popup captions for different images on my site.

I am hoping to find a substitute for what I used to have. Clicking on images displayed a popup caption. Mouseover (thanks to alt and title attributes) still does, and I didn't want to build tables around each image with ordinary captions. You can still see this with much of my Web site, as on this page: Click on the image, and you'll see. However, my home page is a blog in WordPress rather than static html, which does not allow this.

That's because I was simply placing an onclick into an a tag around the image, and WordPress strips those out. The href is simply to #, but the onclick was equal to a function defined in a javascript file defined as script in the header. I can give you the full javascript if it helps.

But the idea is that the function has three variables, for image artist, title, and source/date. So my onclick would be set equal to popcap(), with the parenthesis containing in single quotes the three variables (sometimes with a | in case one was too long to fit on one line).

I'm trying to see if I can achieve maybe not exactly the same thing, but some use of javascript to set variable content in the popover I've defined with WPMU Dev. I've another outstanding question about getting started with the plugin, but this goes to the heart of my needs and the actual content. If you'd like me to share any code, please let me know. John

  • Tyler Postle

    Hey John,

    Hopefully I'm understanding what you're after, you just want the pop up to show on-click with your images on the blog? Just like it does in your html site.

    To be honest, I haven't tried this with the plugin yet. Have you tested it? If so, what was the result?

    Do you mind posting your code? Perhaps that will help us make some progress here :slight_smile:

    Look forward to your reply!


  • John

    Thanks. Two issues. First, you asked about the "when." I started another support topic and received no replies. I want to designate some images as clickable, giving them popup captions. It was suggested that I put in the a tag for those images an id, making that id the condition for pop overs. It has worked, but only in part. That is, I created a test pop over (reading simply "Author: Title" on one line and "(Source, Date) on the next, and it did popup in a test of an image in an unpublished post. However, now it also pops up very briefly (before vanishing) every single time one comes to my blog or to any post within it. That's not acceptable. In fact, it looks puzzling and inane. (What IS this thing flashing by?)

    Second, I appreciate your asking for code. I assume that means my old code. I'll be sparing here, leaving out angle brackets, quotes, and other things that this forum might strip out. But here's what I'm trying to replicate. As I say, you can still see it if you go to one of my longer, static html Web pages rather than to the blog on my home page.

    This was achieved with (this is only a sample, as the variables change each time) a href=# onclick=popcap(|A Woman Reading a Letter, Jan Vermeer, (Kemper Palace, Dresden, 1657));return false;

    Here the | is there to put the title on a second line, as my default is to run artist and title together separated by a colon. In this, of course, the three variables are surrounded by single quotes, while the two items on the left of equal signs are surrounded by double quotes.

    Next, each static page contains in its head (again, you'll have to imagine angle brackets and quotes) the following: script type=text/javascript src=style/caption.js></script>

    This also appears in the header template for my blog in WordPress.

    Finally, caption.js defines the popcap function. Here I'll leave off some detail, afraid that code will be stripped out but can make it available next time in whatever way helps. But this script begins function popcap(title, artist, source (followed by open {). From there, it has variable lines for title.replace (indicating that a line break will follow), source.replace, windowvars such as width,, and then a series of lines for code (each beginning code followed by a + sign joined to an equal sign), which write a Web page.

    At its heart is two lines, where again imagine the angle brackets and quotes:

    p align=center strong + artist + : cite + title + /cite


    br / small + source + /small /strong /p

    Hope that helps!

  • John

    Interesting, and thank you! I actually compose in a very old html editor, without a wysiwyg mode, and copy the post into WordPress in text mode. However, I have always then gone to visual to read it over and make light edits. (When you see it more like ordinary prose, it's like having a fresh eye. Besides, it's a fast way to check that the image is visible, meaning I remembered to ftp it to my site.) I also then read the post over in visual mode days or weeks later, just before "publishing.

    I had noticed that it's precisely when I go into visual mode that the code vanishes, but it hadn't occurred to me that if I can manage never to go into visual mode I'd be ok. I still couldn't quite believe it this morning when I tested changes that they'd still be intact both in preview and on my site.

    But if I can now discipline myself never to hit that visual table, I might be ok. I just went over all the posts in my blog. It helped that I delete them after six months and that quite a few haven't been touched since an update of WordPress started stripping the code out.

  • Tyler Postle

    Hey John,

    Hope you're doing well today!

    I believe this is the Pop Over that is still unresolved for you correct?

    However, now it also pops up very briefly (before vanishing) every single time one comes to my blog or to any post within it.

    This happens when the popup is set to be shown "immediately" under certain conditions. To resolve this, change it to 1 second. Then it won't flash up anymore :slight_smile:

    Let us know if this does the trick John!


  • John

    I appreciate your following up. I should probably call it closed, since it sounds like the plug-in won't be the best way to achieve the variable content I sought. Sounds like that'll have to come from javascript.

    I'll miss the ease of last-minute editing in WordPress's visual mode, especially in deleting images with a click and the delete key. But I'll discipline myself to keep the text mode and cope. After all, if I weren't in text mode to enter a post, I wouldn't have had in the first place the javascript it's been stripping out.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.