Skip to:
Content
Pages
Categories
Search
Top
Bottom

Image code question


  • cbalke
    Participant

    @cbalke

    How do I go about getting into and editing the coding for the “img” button?

    Currently the code that is applied is (img src=”xxxxxxxx” alt=”ffs” /) with the ( ) being < > and the xxx’s being the images URL.

    I want to change the coding to (url=xxxxx)(img)xxxxx(/img)(/url) with the parentheses replaced with square brackets and xxxxx with the photo’s url.

    By doing so, the images can be clicked which would open a lightbox

    Thanks in advance for the help.
    Wordpress 4.1
    bbPress 2.5.4-5380

Viewing 5 replies - 1 through 5 (of 5 total)

  • cbalke
    Participant

    @cbalke

    Bump..


    Mizagorn
    Participant

    @mizagorn

    I am looking at why the ‘img’ shortcode is making URLs have encoding in them so that the browser will not load an image.

    Anyway, the shortcode code is in bbcodes.php in lines 487-502. That might get you started, but I don’t think that has the part where it actually generates the “src” and “alt” tags.

    What I usually do is use “Inspect Element” in FF or Chrome, find the class or ID for the element, then use grepWin to search for that within the WP code files. That would work only if you have FTP’d the files to your local rig, though.


    Mizagorn
    Participant

    @mizagorn

    Woops, that was for the GD bbPress Tools plugin. Sorry!!

    If (WHEN!) I find where bbPress embeds the images, I’ll let you know. 🙂


    alfonma
    Participant

    @alfonma

    I think the code is in the wp-includes/js/quicktags.js file on line 621 , and in the quicktags.min.js on line 152 of the formated version.

    if ( src ) {
       alt = prompt(quicktagsL10n.enterImageDescription, '');
       this.tagStart = '<img src="' + src + '" alt="' + alt + '" />';
       qt.TagButton.prototype.callback.call(this, e, c, ed);
     }
    

    best regards


    Mizagorn
    Participant

    @mizagorn

    Beautiful @alfonma, nice find. I’ll have to learn to extend my search to include native WP instead of just plugins. Hope this helps others as well. Thanks!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar