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

    (@tijmensmit)

    Add this to the functions.php in your theme folder to enable the comments for the wpsl custom post types.

    You do need to first enable the comments on the individual store pages before it shows up ( there are ways to do this all in bulk ).

    add_filter( 'wpsl_post_type_args', 'custom_post_type_args' );
    
    function custom_post_type_args( $args ) {
    
        array_push( $args['supports'], 'comments' );
    
        return $args;
    }

    Then create a single-wpsl_stores.php page in your theme folder, and place this code in that file. What it does is that it will overwrite the default store page template, and since it includes extra code to show the ‘edit’ link, and comment section it will solve your problem.

    You can play around with the order of the map, comments, edit link etc, and use CSS to style / position it in anyway you want to. If it completely breaks, then take a look at the single.php in your theme folder and use that as a base to place the php code from my example in.

    Thread Starter Maskpage

    (@maskpage)

    I’ve tried for the last 2 days and it didn’t show anything, is there you can write a step by step solution? thank you

    Plugin Author Tijmen Smit

    (@tijmensmit)

    If you click on the ‘Screen Options’ tab in the right top corner when you are editing a store page, you do see ‘Comments’ and you enabled it?

    It doesn’t show in the admin area, or just not on the frontend?

    There’s no Comments in Screen Options

    Plugin Author Tijmen Smit

    (@tijmensmit)

    @satwikabali did you add the code example I provided to the functions.php? Are comments enabled on your site? You can check this under settings -> discussions -> Allow people to post comments on new articles

    yes i add to function php trough dashboard and my whole website dissapear

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Can you try to add it through the ftp editor?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    @satwikabali you are using version 2.0+?

    Just to update this:

    1. If you are using someone else’s theme, then don’t directly edit the functions.php file there (it will be overwritten the next time you update the theme), instead create a child theme of that theme.
    2. You don’t need to create a template for individual stores – WPSL is not using a custom template for this – looks like it is using the standard WordPress template to show a store.
    3. Activate your new child theme.
    4. You should now have a box on the store edit pages to enable/disable comments.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Need to add Comment to each location’ is closed to new replies.