Last active
August 29, 2015 13:56
-
-
Save joshuadavidnelson/8850402 to your computer and use it in GitHub Desktop.
Modify comment settings for custom post types in Genesis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change Comments byline | |
add_filter( 'genesis_post_info', 'jdn_ticket_info_filter' ); | |
function jdn_ticket_info_filter( $post_info ) { | |
if( get_post_type() == 'ticket' ) { | |
$post_info = 'Ticket Opened: [post_date] [post_comments zero="Reply" one="1 Reply" more="% Replies"]'; | |
} else { | |
$post_info = 'Posted [post_date] by [post_author] [post_comments zero="Leave a Comment" one="1 Comment" more="% Comments"]'; | |
} | |
return $post_info; | |
} | |
// Change Comment Title and Form Default | |
add_filter( 'genesis_title_comments', 'jdn_ticket_title_comments' ); | |
add_filter( 'comment_form_defaults', 'jdn_ticket_comment_form_defaults' ); | |
function jdn_ticket_comment_form_defaults( $defaults ) { | |
if( get_post_type() == 'ticket' ) { // for cpt "ticket" | |
$defaults['title_reply'] = __( 'Reply' ); | |
$defaults['must_log_in'] = ''; | |
$defaults['logged_in_as'] = ''; | |
$defaults['comment_notes_before'] = ''; | |
$defaults['label_submit'] = __( 'Submit', 'custom' ); | |
$defaults['comment_field'] = '<p class="comment-form-comment">' . '<textarea id="comment" name="comment" cols="45" rows="8" tabindex="4" aria-required="true"></textarea>' . '</p><!-- #form-section-comment .form-section -->'; | |
} else { // default | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
} | |
return $defaults; | |
} | |
function jdn_ticket_title_comments() { | |
if( get_post_type() == 'ticket' ) { // for cpt "ticket" | |
$title = ''; | |
} else { // default | |
$title = '<h3>Discussion</h3>'; | |
} | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment