Changing Leave a Comment under Archive Only?

Community Forums Forums Design Tips and Tricks Changing Leave a Comment under Archive Only?

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Scott Buehler 1 year, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9561

    Scott Buehler
    Participant
    Post count: 50

    I’ve had a lot of success using functions.php snippets directly in the single-cpt.php file.

    However, under archive-cpt.php I am trying to modify “Leave a Comment” and the below snippet isn’t working:

    /** Modify the comment link text */
    add_filter( 'genesis_post_meta', 'post_meta_filter' );
    function post_meta_filter( $post_meta ) {
    return '[post_comments zero="Leave a Review" one="1 Review" more="% Reviews"]';
    }

    What should be changed to get it to work on my CPT archive page?


    Scott Buehler
    WebHostingChoose.com

    • This topic was modified 1 year, 8 months ago by  Scott Buehler. Reason: Clean up code
    • This topic was modified 1 year, 8 months ago by  Scott Buehler.
    • This topic was modified 1 year, 8 months ago by  Scott Buehler. Reason: Clean up code
    • This topic was modified 1 year, 8 months ago by  Scott Buehler.
    #9857

    Chris Cree
    Participant
    Post count: 147

    Instead of adding it to your post type files, put something like this in your functions.php file:
    [php]/** Modify the comment link text */
    add_filter( ‘genesis_post_meta’, ‘post_meta_filter’ );
    function post_meta_filter( $post_meta ) {
    if ( is_singular( ‘custom-post-type’ ) {
    return ‘[post_comments zero="Leave a Review" one="1 Review" more="% Reviews"]‘;
    }
    else return ‘[post_comments zero="No Comments" one="1 Comment" more="% Comments"]‘;
    }[/php]

    Change out custom-post-type with the actual custom post type you want it to apply to. See is_singluar() in the WP Codex.


    #9900

    Scott Buehler
    Participant
    Post count: 50

    Hmm none of that is working.

    Even if I use this code directly in my functions.php and change “Leave a Comment” to “asdasdsadsadasd” it doesn’t change on my main page, blog page, or anywhere. That’s weird.

    I read Nick on the other read only forum ask if they have Simple Edits installed. I did. I deactivated it, removed footer completely in functions.php, and uninstalled it (not needed now). Footer is removed and still the code snippet isn’t modifying the “Leave a comment” to “asdasdsadasdad” on posts with 0 comments.


    Scott Buehler
    WebHostingChoose.com

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.