• Resolved rostam24

    (@rostam24)


    Hi!

    I’m using the Adapt theme by WPexplorer. I really like the theme, but I would like to add comments under portfolio items.

    I’ve tried adding <?php comments_template(); ?> in a couple of places, but it didn’t do the trick. Comments do work for regular blog posts and pages, but like I said, I would also like to have comments for portfolio items ??

    I hope you guys can help out! Thank you very much for your time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Create a child theme for this theme and activate it.

    Create a functions.php file inside wp-content/themes/wpex-adapt-child/ and place the following code.

    <?php
    add_action('init', 'add_comments_to_portfolio');
    function add_comments_to_portfolio() {
    	add_post_type_support( 'portfolio', 'comments' );
    }

    You may need to use comments_template() if the “portfolio” post type is handled by a separate single-portfolio.php file.

    Thread Starter rostam24

    (@rostam24)

    Thank you for the quick reply!

    I didn’t create a child theme (I assumed this wasn’t necessary), but I did add the hook to functions.php. No luck yet :-/

    The only files I could find with portfolio in the name are:
    archive-portfolio.php
    content-portfolio.php
    portfolio-filterable.php

    And adding comments_template() to them doesn’t seem to work….

    Any other ideas? Again, thank you for your help!

    Thread Starter rostam24

    (@rostam24)

    Nevermind, by using the editor in wordpress I could find single-portfolio and not it works. Thank you for your help! ??

    You’re welcome!

    I didn’t create a child theme (I assumed this wasn’t necessary)

    A child theme IS necessary if you plan to edit PHP. If you omit doing it now you will refrain from updating the theme as it’ll overwrite your changes.

    Finally a day will come when you update WordPress core and find that this theme breaks as it uses outdated and removed functions.

    So it is best you move the changes to a child theme now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adapt theme How to add comments to portfolio items’ is closed to new replies.