• Resolved dakey23

    (@dakey23)


    Hi tijmen,

    (Sorry for asking, because 2.0 isn’t released yet, but I’m addicted to the new version already :D)

    In the 2.0 version on the store page (ex. domain.com/stores/mystore), the comments are default switched off. Is it possible to enable them? It’s great for using it for store review by users.

    https://ww.wp.xz.cn/plugins/wp-store-locator/

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

    (@tijmensmit)

    Add this to the functions.php in your theme folder to enable the comments. You probably need to tick a box on the store page under ‘Discussion’ -> ‘Allow comments’.

    add_filter( 'wpsl_post_type_args', 'custom_post_type_args' );
    
    function custom_post_type_args( $args ) {
    
        $args['supports'] = array( 'title', 'editor', 'author', 'excerpt', 'revisions', 'thumbnail', 'comments' );
    
        return $args;
    }

    Create a template for the wpsl_stores custom post types.

    So you create a file called ‘single_wpsl-stores.php’, and the best way to get started with this is to open the ‘single.php’ from your theme folder. Copy the content and place it in the ‘single_wpsl-stores.php’ file.

    You probably see this:

    <?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', 'single' ); ?>
    <?php endwhile; // end of the loop. ?>

    Remove it and replace it with this:

    <?php
        echo do_shortcode( '[wpsl_map]' );
        echo do_shortcode( '[wpsl_address]' );
    ?>
    <?php comments_template( '', true ); ?>

    This will show the map, address and underneath it the comments form.

    Thread Starter dakey23

    (@dakey23)

    Hi Tijmen,

    Many thanks for your code 🙂

    I use for example the Twenty Fourteen theme.
    I added all codes into functions.php (in the theme dir) and created the single_wpsl-stores.php based on the single.php with your additions, and put that file in the same dir as single.php.

    The problem is that when I edit or add a new shop, no option is available for checking a box ‘Discussion’ -> ‘Allow comments’ (like in normal blog or page posts).

    Also in the header drop-down menu (screen properties) the comment option is not available.

    Need I add the add_filter function in the functions.php between specific lines? Now, I just copied the code at the end of this file..

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Can you check if the comments are enabled on your site on the WP Settings -> Discussion page?

    Thread Starter dakey23

    (@dakey23)

    Jup, it is enabled.
    I’m able to post comments in general posts and pages.

    Also, per general post or page I’m able to enable/disable comments in the admin area.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Can you send me an email at info at tijmensmit.com?

    Thread Starter dakey23

    (@dakey23)

    I just did 😉

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘2.0 store page with comments enabled?’ is closed to new replies.