• Resolved Bradley Allen

    (@bradley)


    When an image is added to the content field, it causes the map to disappear on the store detail page.

    I’m using a custom single store template.

    I can add an image to the page if it is set as the featured image. However this is not an ideal solution, and featured images currently display in search results on the main map page.

    An embedded video does not seem to be causing any conflicts.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    Can you check the error log on your server if something shows up that’s related to the store locator? When you check the HTML output, it’s complete? ( the structure ends as expected? ).

    Where does the image come from? You just link to it in the content like ?

    Thread Starter Bradley Allen

    (@bradley)

    The problem seems to be with the custom single store template I created. I’m using a child theme of Twenty Sixteen. I figure that I’m making an error. If you’re able to take a look and let me know, that would be really appreciated and also helpful for other people working with Twenty Sixteen.

    I can get the example working for a child theme of Twenty Fifteen, however I’m having trouble, see code below, making the appropriate changes to the HTML structure of single.php for Twenty Sixteen.

    When editing a store, using a basic img tag works correctly. However when I click the button to ‘Add Media’ then there is a problem. The img tag includes a class with alignment. If I remove the class, then the map displays. But if the class remains class="aligncenter size-full wp-image-156", then the map will disappear.

    <?php
    /**
     * Single WPSL store template for the Twenty Sixteen theme.
     *
     * @package WordPress
     * @subpackage Twenty_Seventeen
     */
    get_header(); ?>
    
        <div id="primary" class="content-area">
            <main id="main" class="site-main" role="main">
                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                   <header class="entry-header">
                        <h1 class="entry-title"><?php single_post_title(); ?></h1>
                    </header>
                    <div class="entry-content">
                    <?php
                        global $post;
                        $queried_object = get_queried_object();
    
                        // Add the map shortcode
                        echo do_shortcode( '[wpsl_map zoom="16"]' );
    
    										// Add the address shortcode
                        echo do_shortcode( '[wpsl_address]' );
    
                        // Add link to directions
    										$address       = get_post_meta( $queried_object->ID, 'wpsl_address', true );
    										$city          = get_post_meta( $queried_object->ID, 'wpsl_city', true );
    										$country       = get_post_meta( $queried_object->ID, 'wpsl_country', true );
    										$destination   = $address . ',' . $city . ',' . $country;
    										$direction_url = "https://maps.google.com/maps?saddr=&daddr=" . urlencode( $destination ) . "";
    
    										echo '<p><a target="_blank" href="' . esc_url( $direction_url ) . '">' . __( 'Directions', 'wpsl' ) . '</a></p>';
    
    										// Add the hours shortcode
                        echo do_shortcode( '[wpsl_hours]' );
    
                        // Add featured image
                        echo get_the_post_thumbnail( $queried_object->ID, 'large' );
    
    										// Add the content
                        $post = get_post( $queried_object->ID );
                        setup_postdata( $post );
                        the_content();
                        wp_reset_postdata( $post );
    
                    ?>
                    </div>
                </article>
            </main><!-- #main -->
        </div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    Thread Starter Bradley Allen

    (@bradley)

    Sorry, however I realize a couple links in the previous comment go to a staging site which requires a login. I’m still troubleshooting and trying to resolve the issue.

    This seems to be a related JavaScript error:

    TypeError: entryFooterPos is undefined
    https://mysite.com/staging/wp-content/themes/twentysixteen/js/functions.js?ver=20160816 line 149
    Thread Starter Bradley Allen

    (@bradley)

    I wasn’t able to figure out the issue using Twenty Sixteen.

    However things seem to be working well using a child theme of Storefront instead.

    I’ll mark this as resolved since I’m not requesting help with the issue anymore.

    Thanks again for the really nice, customizable plugin, and all your generous support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Map Missing on Store Page when Image Added to Content’ is closed to new replies.