how to add a lightbox to images in Ubercart cart? - drupal

Can I apply "Custom formatters" presets to Ubercart cart ?
I need to customize the html code of the images in the cart.
I'm trying to do it with hook_form_alter but what I get is the output html and it is too late to modify it:
[#value] = > < a
href="/website/node/87">< img
src="http://localhost/website/path/to/picture
1.png" alt="" title="" class="imagecache imagecache-cart"
width="100" height="221" />
I need to add "rel=lightbox" attribute to and change href path.
thanks

I think you want to look at hook_uc_image_widget. I can't find the API documentation for it, but you can see an example implementation in the jQZoom module.

Related

How to add gallery functionality to WordPress block plugin

I'm wanting to add gallery functionality to a WP Gutenberg block plugin. Easy to add a single image option with the media library, but I'm not sure how I would add the element for a gallery which then gives you all the built in WordPress functionality of caption and drag/drop sorting of the gallery. Having a real hard time finding a tutorial on including this functionality.
I did find one plugin that does just about what I want as the base, but want to extend the block to include other fields. Plugin in question is getwid slider block.
Figured it out.
Needed to add addToGallery=true and gallery=true to the mediaupload tag.
<MediaUpload
addToGallery={true}
onSelect={(media) => {setAttributes({images: [...images, ...media]});}}
type="image"
multiple={true}
gallery={true}
value={images}
render={({open}) => (
<Button className="slider-button select-images-button is-button is-default is-large" onClick={open}>
Add images
</Button>
)}
/>

How would I remove this from all wordpress posts

In every wordpress post I have code like this -
<img src="http://domain/wp-content/uploads/2016/08/Black-Bosch-Avantixx-HBM13B261B-Electric-Double-Oven-300x266.jpg" alt="black-bosch-avantixx-hbm13b261b-electric-double-oven" width="300" height="266" class="alignright size-medium wp-image-367913" />
Obviously each post is a different name, how can I remove this paragraph inside all posts as I have thousands.
Is there a command I can do using phpmyadmin?
Step by step would be great thanks.
You have try to delete the img? Do you have use some plug-in downloaded from external website? I don't think you need db i think it's something in JS or php if this you can use add to your js file:
$(document).ready(function() {
$(".wp-image-367913").css("display","none")
});
If it's only the code, you need to check your article.php or single.php or your post php page file and see if there are this link write some where.

Wordpress TinyMCE Stripping Custom Caption Shortcode Attributes

I've extended Wordpress' caption shortcode with a couple custom attributes in addition to caption's default: ID, align, width, and class. My new attributes work great while everything is in Text mode. However if I switch to Visual mode and then back to Text my custom attributes get stripped off the shortcode.
For instance:
[caption id="attachment_6" align="alignright" width="300" custom_attr="value"]<img src="http://localhost/wp-content/uploads/2010/07/800px-Great_Wave_off_Kanagawa2-300x205.jpg" alt="Kanagawa" title="The Great Wave" width="300" height="205" class="size-medium wp-image-6" /> The Great Wave[/caption]
becomes:
[caption id="attachment_6" align="alignright" width="300"]<img class="size-medium wp-image-6" title="The Great Wave" src="http://localhost/wp-content/uploads/2010/07/800px-Great_Wave_off_Kanagawa2-300x205.jpg" alt="Kanagawa" width="300" height="205" /> The Great Wave[/caption]
The attribute is removed and the classes on the image get swapped around so clearly some process is going on.
I'm inserting my custom attributes via the media_send_to_editor event that occurs between the media library and the editor. I've tried adding these new attributes via the tiny_mce_before_init event but can't find any real documentation beyond this WIP VIP tutorial which only seems to work from standard HTML DOM elements and not WP shortcodes.
Does anyone know how Tiny MCE handles content filtering of shortcodes, especially when it comes to switching between Visual and Text modes? Is there a filter or action where I can add my custom attributes to a whitelist of what's allowed in that transition? Thanks.

WordPress' ACF plugin: break at instructions field

When you create a field in the ACF (Advanced Custom Fields) plugin in WordPress, you can add an instruction to the field. Is there a way to add an break to it?
Yes - the ACF Instructions setting accepts some basic HTML.
A line break can be added using <br />.
Well put #Tim Malone. I'm sharing an example for a description in one of my custom fields.
Wrap a word in a span tag to highlight:<br/><br/>
<code><span><span style="background-color: #ffffcc;">highlight</span></span></code>
<br/><br/>

How to do a mouseover on wordpress?

With Images
http://i.imgur.com/snv3pEE.png
I just can do like this:
http://i.imgur.com/D6Hr6fB.png
code:
<img class="tooltip" title="HERE THE TOOLTOP" alt="" src="img.png">
And I can't put images on title=""
You have to look at the way you approach your information for this. If this is going to be inside the loop you have to include it in your template. I would look into using custom fields and meta-boxes to simplify the backend part.
If you're not too familiar doing this I would look into the http://www.advancedcustomfields.com plugin and within your template put a if statement that will display a div/img and position it. They have some documentation and I would learn the basics of if/else in php. Then I would use a simple mouseenter / mouseleave jquery event to show the hidden div or toggle.

Resources