Before you ask please READ THIS

Comments in Works

in Rife Posts: 127
Hi !

Is there a way to display the comments section under each work ?

Thank you !

Sophie

Comments

  • AirAir
    Posts: 10,970
    Hey :-)

    You are the first to ask about it:-)
    Currently, there are no comments for albums & works. I will add it to feature requests.

    With kind regards.

  • Really ? Well, I don't want you to modify your theme just for me ! :) Do you think I can add some php lines on works-template.php, or is it too complicated ? (If it is, I will ask to a dev, cause I need this function in about 12 days : It will be a part of my main course, so the students can as questions beside each exercise).

    Thank you !

    Sophie
  • AirAir
    Posts: 10,970
    Hard to say, it can be a quite wide modification, as it may require to edit plugin for custom post types also.
    I could test it tomorrow.

    However, maybe a better idea would be to use Pages? They have comments, that can be turned on/off per each page. You can also arrange them in hierarchies.

    Pages also have much more flexibility in my opinion.

    With kind regards.
  • With my subscription system and the organisation of courses allready existing, it would be a struggle to use posts or articles. I can only use albums or works, and I like the way it displays also, with "following" and the small grid to go back to the list.

    So let me know if you found a way ! :) Thank you very much for your time.
  • AirAir
    Posts: 10,970
    It looks that is quite easy. I should consider adding this in next update.

    Do this:
    1. In child theme, in functions.php add this
    function wp1482371_custom_post_type_args( $args, $post_type ) {
        if ( $post_type == "work" ) {
            $args['supports'] = array( 'title', 'thumbnail', 'editor', 'excerpt', 'comments' );
        }
    
        return $args;
    }
    add_filter( 'register_post_type_args', 'wp1482371_custom_post_type_args', 20, 2 );
    
    This enables comments support for works.

    2. Modify theme function in advance\utilities\cpt-work.php line ~93. Under this
    <?php echo wp_kses_post($meta_content); ?>
    				</div>
    add this code:
    				<?php
    				// If comments are open or we have at least one comment, load up the comment template.
    				if ( ( comments_open() || get_comments_number() ) ) :
    					comments_template( '', true );
    				endif;
    				?>
    3. Be sure to enable comments is work
    image


    One requirement for this to work: you have to have any text content in your work.

    With kind regards.
    screenshot-192.168.1.2-2018-07-12-15-48-29.png
    565 x 271 - 5K
  • Wow incredible ! It works perfectly ! Thank you for your awesome support. :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!