[Resolved] niche theme => visible code on my site

Home Forums Support niche theme => visible code on my site

  • This topic has 5 replies, 2 voices, and was last updated 5 months ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1410062
    jl.robles@atrinium.com

    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 ?>

    #1410073
    jl.robles@atrinium.com

    I think that is something relate with elements

    #1410130
    Tom
    Lead Developer
    Lead Developer

    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>
    #1411473
    jl.robles@atrinium.com

    Hey,

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

    Thank for yu reply

    #1411526
    jl.robles@atrinium.com

    I found it.

    Thanks

    #1411828
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.