Problem with custom single template

Posted in: Newspaper
Post count: 10

Hi,

I use a plugin called WP Store locator that uses a custom post type called “wpsl_stores”. This one is already recognized and listed successfully in the Theme Panel of your Theme as a custom post type.

The plugin offers the option to use a custom store page template that I have already used very successfully with my old theme. You can see it working properly with my old theme here: https://www.mudradar.de/ocr-trainingslocation/stuntwerk-koeln

After switching to your theme I wanted to use my custom post template again. To avoid any incompatibilities I decided to do it step by step and create a custom post template along your tutorial and documentation.

As described here: https://forum.tagdiv.com/custom-post-type-support/ I created a new custom single template for it in my child theme.

I copied the “single_template_1.php” into my child theme folder “Newspaper-child” and renamed it into “single-wpsl_stores.php”. I also copied “loop-single-1.php” and renamed it into “loop-single-wpsl_stores.php”.

In my “single-wpsl_stores.php” I changed “locate_template(‘loop-single-1.php’, true);” into ” locate_template(‘loop-single-wpsl_stores.php’, true);” to make the correct loop file been loaded.

../wp-content/themes/Newspaper-child/single-wpsl_stores.php
../wp-content/themes/Newspaper-child/loop-single-wpsl_stores.php

So I made my changes in the “loop-single-wpsl_stores.php” in the <div class=”td-post-content”> exactly the way I did it when using my old theme:


<div class="td-post-content">
<?php //echo $td_mod_single->get_content();?>

<?php
global $post;
$queried_object = get_queried_object();

$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 ) . "";

// Add the map shortcode
echo do_shortcode( '[wpsl_map height="350" zoom="14"]' );

// Add the content
$post = get_post( $queried_object->ID );
setup_postdata( $post );
the_content();
wp_reset_postdata( $post );

// Add the address shortcode
echo "<h2>Adresse & Kontakt</h2>";
echo do_shortcode( '[wpsl_address]' );

// Add the small map shortcode
echo do_shortcode( '[wpsl_map width ="350" height="200" zoom="14" map_type_control="false"]' );
echo '<p>' . __( 'Route planen', 'wpsl' ) . ' </p>';

// Add the opening hours
echo "<h2>Öffnungszeiten</h2>";
echo do_shortcode( '[wpsl_hours]' );

?>
</div>

I uploaded both files into my “Newspaper-child” Theme folder but found out that my changes and amendments are not fully accepted.

I expected to get a page that shows it like here (https://www.mudradar.de/ocr-trainingslocation/stuntwerk-koeln) with the following Elements:
– Map from shortcode
– Content from Editor
– Adress from shortcode
– small Map from shortcode
– Directions link
– opening hours from shortcode

Instead of this, additional information are displayed:

– Map from shortcode
– Content from Editor
– Map = NOT OK
– Adress = NOT OK
– Opening hours = NOT OK
– Adress from shortcode
– small Map from shortcode
– Directions link
– opening hours from shortcode

It seems as if the_content(); (btw: I also tried it with echo $td_mod_single->get_content(); with same results) shows not only the content from the editor (as expected) but also the additional fields where the address and opening hours and the map are maintained in the backend.

Adress & opening hours are part of a box called “store details” and the map is part of a box called “Store Map” in the backend.

It seems as if my custom post template is handled in another way at it has been done before with my old theme. The extra boxes “store details” and “Store Map” haven’t been displayed before switching to your theme and I am wondering how to avoid this.

Do I have forgotten to make any changes in the theme Panel? Or is there a way to filter the additional information?

Looking forward to getting your suggestions on this. Many thanks in advance,
Dinah

Post count: 10

Boxes “Store Details” + “Store map” in backend
https://picload.org/view/dgrwwrra/wp-backend-boxes.png.html

unwanted Output of those Boxes in Frontend
https://picload.org/view/dgrwwrrl/wp-frontend-boxes.png.html

expected Output as it has worked before
https://picload.org/view/dgrwwrrw/wp-frontend-correct.png.html

Post count: 23312

Hello dinahmight,

Unfortunately, this type of plugin has not been tested with our theme and also, we do not know the theme’s behaviour with this type of plugin and we cannot provide support for this untested plugins, sorry! All as you want to require to do such customizations and also, please notice that we cannot provide this type of services at the moment, sorry! If you want to display more levels in our theme or if you want to implement any others features through our theme and if you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you because we cannot provide custom services at the moment, sorry!

Thanks for the message!

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.