Site logo

Archived topic

niche theme => visible code on my site

5 replies · Started by Forum User on August 19, 2020

Viewing posts 1–6 of 6

I see code in my site

https://montsaint.live-website.com/producto/happy-ninja-2/

get_id() ) ) { $attachment_ids[0] = get_post_thumbnail_id( $product->get_id() ); $attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' ); $attachment_alt = get_post_meta( $attachment_ids[0], '_wp_attachment_image_alt', TRUE); $attachmnent_title = get_the_title( $attachment_ids[0] ); ?> <?php echo $attachment_alt; ?> get_gallery_image_ids(); foreach( $product_image_ids as $product_image_id ) { $image_url = wp_get_attachment_url( $product_image_id, 'full' ); $image_alt = get_post_meta( $product_image_id, '_wp_attachment_image_alt', TRUE); $image_title = get_the_title( $product_image_id ); echo '' . $image_alt . ''; } } // Closing div found in Close Summary Wrap element ?>

I think that is something relate with elements

Hi there,

Yes, that seems like an Elements issue.

If someone saves an Element that contains PHP but their user account doesn't have the capability to save unfiltered HTML, it will escape the PHP for security purposes.

If your account has that capability, you can go to "Appearance > Elements" and open the "Gallery Stack" Element.

Then replace its content with this:

<div class="woo-sumamry-wrap"><!-- open wrap -->
	<div class="woo-gallery-stack hide-on-mobile">
		<?php 
			global $product;

			// Get post product thumbnail
			if ( has_post_thumbnail( $product->get_id() ) ) {
				$attachment_ids[0] = get_post_thumbnail_id( $product->get_id() );
				$attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' ); 
				$attachment_alt = get_post_meta( $attachment_ids[0], '_wp_attachment_image_alt', TRUE);
				$attachmnent_title = get_the_title( $attachment_ids[0] );
			?>    
				<img src="<?php echo $attachment[0] ; ?>" alt="<?php echo $attachment_alt; ?>" title="<?php echo $attachmnent_title; ?>" />
			<?php 
			}

			// Get Product Gallery Images
			if ( method_exists( $product, 'get_gallery_image_ids' ) ) {
				$product_image_ids = $product->get_gallery_image_ids();

				foreach( $product_image_ids as $product_image_id ) {
					$image_url = wp_get_attachment_url( $product_image_id, 'full' );
					$image_alt = get_post_meta( $product_image_id, '_wp_attachment_image_alt', TRUE);
					$image_title = get_the_title( $product_image_id );
					echo '<img src="' . $image_url . '" alt="' . $image_alt . '" title="' . $image_title . '">';
				}
			}
			// Closing div found in Close Summary Wrap element
		?>
</div>

Hey,

Where I can check if my "user account doesn’t have the capability to save unfiltered HTML"?

Thank for yu reply

I found it.

Thanks

No problem!

This archived topic is closed to new replies.