Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter daymobrew

    (@daymobrew)

    I think I found a solution – remove the cpt_template() filter and add a custom shortcode to ‘the_content’. Thanks for adding WP_Store_locator class to $GLOBALS.

    add_filter( 'the_content', 'bh_custom_single_store_content', 5 );
    function bh_custom_single_store_content( $content ) {
      if ( is_singular( 'wpsl_stores' ) ) {
          remove_filter( 'the_content', array( $GLOBALS['wpsl']->frontend, 'cpt_template' ) );
          // Add WP Store Locator map and custom shortcode for address.
          return '[wpsl_map][hb_wpsl_address]' . $content;
      }
    
      return $content;
    }

    I copied WPSL_Frontend::show_store_address() function to a new name and edited it to add the new fields I added.

    Is this a good solution?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    How to create a custom template is explained in this article.

    Thread Starter daymobrew

    (@daymobrew)

    Even though it gives a lot of control, I was trying to avoid that option because I would have had to duplicate a lot of code (using GeneratePress).

    My solution works though it could be a maintenance problem if [wpsl_address] changes in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change layout of single store page’ is closed to new replies.