Forum Replies Created
-
AuthorPosts
-
jeremyers1Member
Thanks.
I want to be able to add some details about the author beneath their author gravatar. Specifically, I am using the GamiPress plugin, and want to add the comment authors GamiPress level beneath their avatar image. (Almost exactly as done here on this forum, except instead of "Participant" or "Moderator" I want the GamiPress achievements to show.)
I wrote a bit about it here, but no one replied.
https://www.studiopress.community/topic/add-gamipress-details-below-avatar-in-comment-section/
Blogger and Author
jeremyers1MemberIf it helps, here are the pertinent code snippets from Genesis Framework and the gamipress for bbpress plugin. I want to somehow combine the two so that the gamipress achievements show up beneath the avatar in the comment section.
Genesis Framework (in /lib/structure/comments.php)
function genesis_html5_comment_callback( $comment, array $args, $depth ) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> <article <?php echo genesis_attr( 'comment' ); ?>> <?php /** * Fires inside single comment callback, before comment markup. * * @since 1.1.0 */ do_action( 'genesis_before_comment' ); ?> <header <?php echo genesis_attr( 'comment-header' ); ?>> <p <?php echo genesis_attr( 'comment-author' ); ?>> <?php echo get_avatar( $comment, $args['avatar_size'] ); $author = get_comment_author(); $url = get_comment_author_url(); if ( ! empty( $url ) && 'http://' !== $url ) { $author = sprintf( '<a href="%s" %s>%s</a>', esc_url( $url ), genesis_attr( 'comment-author-link' ), $author ); } /** * Filter the "comment author says" text. * * Allows developer to filter the "comment author says" text so it can say something different, or nothing at all. * * @since unknown * * @param string $text Comment author says text. */ $comment_author_says_text = apply_filters( 'comment_author_says_text', __( 'says', 'genesis' ) ); if ( ! empty( $comment_author_says_text ) ) { $comment_author_says_text = '<span class="says">' . $comment_author_says_text . '</span>'; } printf( '<span itemprop="name">%s</span> %s', $author, $comment_author_says_text ); ?> </p> <?php /** * Allows developer to control whether to print the comment date. * * @since 2.2.0 * * @param bool $comment_date Whether to print the comment date. * @param string $post_type The current post type. */ $comment_date = apply_filters( 'genesis_show_comment_date', true, get_post_type() ); if ( $comment_date ) { printf( '<p %s>', genesis_attr( 'comment-meta' ) ); printf( '<time %s>', genesis_attr( 'comment-time' ) ); printf( '<a href="%s" %s>', esc_url( get_comment_link( $comment->comment_ID ) ), genesis_attr( 'comment-time-link' ) ); echo esc_html( get_comment_date() ) . ' ' . __( 'at', 'genesis' ) . ' ' . esc_html( get_comment_time() ); echo '</a></time></p>'; } edit_comment_link( __( '(Edit)', 'genesis' ), ' ' ); ?> </header> <div <?php echo genesis_attr( 'comment-content' ); ?>> <?php if ( ! $comment->comment_approved ) : ?> <?php /** * Filter the "comment awaiting moderation" text. * * Allows developer to filter the "comment awaiting moderation" text so it can say something different, or nothing at all. * * @since unknown * * @param string $text Comment awaiting moderation text. */ $comment_awaiting_moderation_text = apply_filters( 'genesis_comment_awaiting_moderation', __( 'Your comment is awaiting moderation.', 'genesis' ) ); ?> <p class="alert"><?php echo $comment_awaiting_moderation_text; ?></p> <?php endif; ?> <?php comment_text(); ?> </div> <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'before' => sprintf( '<div %s>', genesis_attr( 'comment-reply' ) ), 'after' => '</div>', ) ) ); ?> <?php /** * Fires inside legacy single comment callback, after comment markup. * * @since 1.1.0 */ do_action( 'genesis_after_comment' ); ?> </article> <?php // No ending </li> tag because of comment threading. }
Gamipress BBPress Integration Plugin (found in /includes/content-filters.php)
<?php /** * Content Filters * * @package GamiPress\bbPress\Content_Filters * @since 1.0.4 */ // Exit if accessed directly if( !defined( 'ABSPATH' ) ) exit; function gamipress_bbp_author_details() { $reply_id = bbp_get_reply_id(); // User is not a guest if ( bbp_is_reply_anonymous( $reply_id ) ) { return; } // Get the author ID $user_id = bbp_get_reply_author_id( $reply_id ); /* ------------------------------- * Points Types ------------------------------- */ // Setup points types vars $points_types = gamipress_get_points_types(); $points_types_slugs = gamipress_get_points_types_slugs(); // Get points type display settings $points_types_to_show = gamipress_bbp_get_points_types(); $points_types_thumbnail = (bool) gamipress_bbp_get_option( 'points_types_thumbnail', false ); $points_types_thumbnail_size = (int) gamipress_bbp_get_option( 'points_types_thumbnail_size', 25 ); $points_types_label = (bool) gamipress_bbp_get_option( 'points_types_label', false ); // Parse thumbnail size if( $points_types_thumbnail_size > 0 ) { $points_types_thumbnail_size = array( $points_types_thumbnail_size, $points_types_thumbnail_size ); } else { $points_types_thumbnail_size = 'gamipress-points'; } if( ! empty( $points_types_to_show ) ) : ?> <div class="gamipress-bbpress-points"> <?php foreach( $points_types_to_show as $points_type_to_show ) : // If points type not registered, skip if( ! in_array( $points_type_to_show, $points_types_slugs ) ) continue; $points_type = $points_types[$points_type_to_show]; $user_points = gamipress_get_user_points( $user_id, $points_type_to_show ); ?> <div class="gamipress-bbpress-points-type gamipress-bbpress-<?php echo $points_type_to_show; ?>"> <?php // The points thumbnail ?> <?php if( $points_types_thumbnail ) : ?> <span class="gamipress-bbpress-points-thumbnail gamipress-bbpress-<?php echo $points_type_to_show; ?>-thumbnail"> <?php echo gamipress_get_points_type_thumbnail( $points_type_to_show, $points_types_thumbnail_size ); ?> </span> <?php endif; ?> <?php // The user points amount ?> <span class="gamipress-bbpress-user-points gamipress-bbpress-user-<?php echo $points_type_to_show; ?>"> <?php echo $user_points; ?> </span> <?php // The points label ?> <?php if( $points_types_label ) : ?> <span class="gamipress-bbpress-points-label gamipress-bbpress-<?php echo $points_type_to_show; ?>-label"> <?php echo _n( $points_type['singular_name'], $points_type['plural_name'], $user_points, 'gamipress-bbp' ); ?> </span> <?php endif; ?> </div> <?php endforeach; ?> </div> <?php endif; /* ------------------------------- * Achievement Types ------------------------------- */ // Setup achievement types vars $achievement_types = gamipress_get_achievement_types(); $achievement_types_slugs = gamipress_get_achievement_types_slugs(); // Get achievement type display settings $achievement_types_to_show = gamipress_bbp_get_achievement_types(); $achievement_types_thumbnail = (bool) gamipress_bbp_get_option( 'achievement_types_thumbnail', false ); $achievement_types_thumbnail_size = (int) gamipress_bbp_get_option( 'achievement_types_thumbnail_size', 25 ); $achievement_types_title = (bool) gamipress_bbp_get_option( 'achievement_types_title', false ); $achievement_types_link = (bool) gamipress_bbp_get_option( 'achievement_types_link', false ); // Parse thumbnail size if( $achievement_types_thumbnail_size > 0 ) { $achievement_types_thumbnail_size = array( $achievement_types_thumbnail_size, $achievement_types_thumbnail_size ); } else { $achievement_types_thumbnail_size = 'gamipress-achievement'; } if( ! empty( $achievement_types_to_show ) ) : ?> <div class="gamipress-bbpress-achievements"> <?php foreach( $achievement_types_to_show as $achievement_type_to_show ) : // If achievements type not registered, skip if( ! in_array( $achievement_type_to_show, $achievement_types_slugs ) ) continue; $achievement_type = $achievement_types[$achievement_type_to_show]; $user_achievements = gamipress_get_user_achievements( array( 'user_id' => $user_id, 'achievement_type' => $achievement_type_to_show, 'display' => true, ) ); // If user has not earned any achievements of this type, skip if( empty( $user_achievements ) ) { continue; } ?> <div class="gamipress-bbpress-achievement gamipress-bbpress-<?php echo $achievement_type_to_show; ?>"> <?php // The achievement type label ?> <span class="gamipress-bbpress-achievement-type-label gamipress-bbpress-<?php echo $achievement_type_to_show; ?>-label"> <?php echo $achievement_type['plural_name']; ?>: </span> <?php // Lets to get just the achievement thumbnail and title foreach( $user_achievements as $user_achievement ) : ?> <?php // The achievement thumbnail ?> <?php if( $achievement_types_thumbnail ) : ?> <?php // The achievement link ?> <?php if( $achievement_types_link ) : ?> <a href="<?php echo get_permalink( $user_achievement->ID ); ?>" title="<?php echo get_the_title( $user_achievement->ID ); ?>" class="gamipress-bbpress-achievement-thumbnail gamipress-bbpress-<?php echo $achievement_type_to_show; ?>-thumbnail"> <?php echo gamipress_get_achievement_post_thumbnail( $user_achievement->ID, $achievement_types_thumbnail_size ); ?> </a> <?php else : ?> <span title="<?php echo get_the_title( $user_achievement->ID ); ?>" class="gamipress-bbpress-achievement-thumbnail gamipress-bbpress-<?php echo $achievement_type_to_show; ?>-thumbnail"> <?php echo gamipress_get_achievement_post_thumbnail( $user_achievement->ID, $achievement_types_thumbnail_size ); ?> </span> <?php endif; ?> <?php endif; ?> <?php // The achievement title ?> <?php if( $achievement_types_title ) : ?> <?php // The achievement link ?> <?php if( $achievement_types_link ) : ?> <a href="<?php echo get_permalink( $user_achievement->ID ); ?>" title="<?php echo get_the_title( $user_achievement->ID ); ?>" class="gamipress-bbpress-achievement-title gamipress-bbpress-<?php echo $achievement_type_to_show; ?>-title"> <?php echo get_the_title( $user_achievement->ID ); ?> </a> <?php else : ?> <span class="gamipress-bbpress-achievement-title gamipress-bbpress-<?php echo $achievement_type_to_show; ?>-title"> <?php echo get_the_title( $user_achievement->ID ); ?> </span> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> </div> <?php endforeach; ?> </div> <?php endif; /* ------------------------------- * Rank Types ------------------------------- */ // Setup rank types vars $rank_types = gamipress_get_rank_types(); $rank_types_slugs = gamipress_get_rank_types_slugs(); // Get rank type display settings $rank_types_to_show = gamipress_bbp_get_rank_types(); $rank_types_thumbnail = (bool) gamipress_bbp_get_option( 'rank_types_thumbnail', false ); $rank_types_thumbnail_size = (int) gamipress_bbp_get_option( 'rank_types_thumbnail_size', 25 ); $rank_types_title = (bool) gamipress_bbp_get_option( 'rank_types_title', false ); $rank_types_link = (bool) gamipress_bbp_get_option( 'rank_types_link', false ); // Parse thumbnail size if( $rank_types_thumbnail_size > 0 ) { $rank_types_thumbnail_size = array( $rank_types_thumbnail_size, $rank_types_thumbnail_size ); } else { $rank_types_thumbnail_size = 'gamipress-rank'; } if( ! empty( $rank_types_to_show ) ) : ?> <div class="gamipress-bbpress-ranks"> <?php foreach( $rank_types_to_show as $rank_type_to_show ) : // If points type not registered, skip if( ! in_array( $rank_type_to_show, $rank_types_slugs ) ) continue; $rank_type = $rank_types[$rank_type_to_show]; $user_rank = gamipress_get_user_rank( $user_id, $rank_type_to_show ); ?> <div class="gamipress-bbpress-rank gamipress-bbpress-<?php echo $rank_type_to_show; ?>"> <?php // The rank type label ?> <span class="gamipress-bbpress-rank-label gamipress-bbpress-<?php echo $rank_type_to_show; ?>-label"> <?php echo $rank_type['singular_name']; ?>: </span> <?php // The rank thumbnail ?> <?php if( $rank_types_thumbnail ) : ?> <?php // The rank link ?> <?php if( $rank_types_link ) : ?> <a href="<?php echo get_permalink( $user_rank->ID ); ?>" title="<?php echo $user_rank->post_title; ?>" class="gamipress-bbpress-rank-thumbnail gamipress-bbpress-<?php echo $rank_type_to_show; ?>-thumbnail"> <?php echo gamipress_get_rank_post_thumbnail( $user_rank->ID, $rank_types_thumbnail_size ); ?> </a> <?php else : ?> <span title="<?php echo $user_rank->post_title; ?>" class="gamipress-bbpress-rank-thumbnail gamipress-bbpress-<?php echo $rank_type_to_show; ?>-thumbnail"> <?php echo gamipress_get_rank_post_thumbnail( $user_rank->ID, $rank_types_thumbnail_size ); ?> </span> <?php endif; ?> <?php endif; ?> <?php // The rank title ?> <?php if( $rank_types_title ) : ?> <?php // The rank link ?> <?php if( $rank_types_link ) : ?> <a href="<?php echo get_permalink( $user_rank->ID ); ?>" title="<?php echo $user_rank->post_title; ?>" class="gamipress-bbpress-rank-title gamipress-bbpress-<?php echo $rank_type_to_show; ?>-title"> <?php echo $user_rank->post_title; ?> </a> <?php else : ?> <span class="gamipress-bbpress-rank-title gamipress-bbpress-<?php echo $rank_type_to_show; ?>-title"> <?php echo $user_rank->post_title; ?> </span> <?php endif; ?> <?php endif; ?> </div> <?php endforeach; ?> </div> <?php endif; } add_action( 'bbp_theme_after_reply_author_details', 'gamipress_bbp_author_details' ); /** * Helper function to retrieve the points types configured at author details screen * * @since 1.0.4 * * @return array */ function gamipress_bbp_get_points_types() { $points_types = array(); $points_types_slugs = gamipress_get_points_types_slugs(); $points_types_to_show = gamipress_bbp_get_option( 'points_types', array() ); foreach( $points_types_to_show as $points_type_slug ) { if( ! in_array( $points_type_slug, $points_types_slugs ) ) { continue; } $points_types[] = $points_type_slug; } return $points_types; } /** * Helper function to retrieve the achievement types configured at author details screen * * @since 1.0.4 * * @return array */ function gamipress_bbp_get_achievement_types() { $achievements_types = array(); $achievement_types_slugs = gamipress_get_achievement_types_slugs(); $achievements_types_to_show = gamipress_bbp_get_option( 'achievement_types', array() ); foreach( $achievements_types_to_show as $achievement_type_slug ) { // Skip if not registered if( ! in_array( $achievement_type_slug, $achievement_types_slugs ) ) { continue; } $achievements_types[] = $achievement_type_slug; } return $achievements_types; } /** * Helper function to retrieve the rank types configured at author details screen * * @since 1.0.4 * * @return array */ function gamipress_bbp_get_rank_types() { $ranks_types = array(); $rank_types_slugs = gamipress_get_rank_types_slugs(); $ranks_types_to_show = gamipress_bbp_get_option( 'rank_types', array() ); foreach( $ranks_types_to_show as $rank_type_slug ) { // Skip if not registered if( ! in_array( $rank_type_slug, $rank_types_slugs ) ) { continue; } $ranks_types[] = $rank_type_slug; } return $ranks_types; }
Blogger and Author
May 24, 2017 at 3:30 pm in reply to: How to use the Smooth Scroll feature with any button on any page #206944jeremyers1MemberThanks.
That moved me in the right direction, and I figured it out.
For anybody else who has this question, I added the following to the enqueue Scripts action in functions.php. I made it conditional so that only certain pages load the scripts.
if ( is_page( array(41794)) ) { wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true ); wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true ); wp_enqueue_script( 'scroll', get_stylesheet_directory_uri() . '/js/scroll.js', array( 'localScroll' ), '', true ); }
Blogger and Author
May 24, 2017 at 8:58 am in reply to: How to use the Smooth Scroll feature with any button on any page #206925jeremyers1MemberRight ...
Maybe I need to be more specific ...
What is the exact php code I put in my functions.php file so that I can use smoothscroll on any page? Also, what code do I need to put on the button itself?
Blogger and Author
May 23, 2017 at 2:23 pm in reply to: How to use the Smooth Scroll feature with any button on any page #206893jeremyers1MemberOk. Thanks. So is there a way this can be added to the functions.php file of my child theme?
Blogger and Author
jeremyers1MemberThanks! That worked.
Blogger and Author
jeremyers1MemberWow, that was easy. Don't know how I missed that. Thanks!
Quick follow-up question ... I cannot seem to change how many blog posts appear on this page. It has 5, but if I change the setting in Settings > Reading to some other number, such as 7 or 10, it still only shows 5. Any way to change this?
Blogger and Author
jeremyers1MemberYes, that is what I ended up doing. It worked. Thanks!
Blogger and Author
jeremyers1MemberI'm using Genesis Simple Hooks Plugin which adds them into my child theme. I need the genesis_after_header and
genesis_entry_footer on most of my pages, but not on the custom page template I am creating. So is there a line of code I can add to the custom page template to remove genesis_after_header and genesis_entry_footer?Maybe this is actually a question for the plugin support over on WordPress....
It looks like this might work:
https://wordpress.org/support/topic/exclude-hooks-from-landing-page-templateI'll give it a try.
Blogger and Author
jeremyers1Membercolink,
Did you submit this question and get an answer from StudioPress on this? If so, could you share it here?
Blogger and Author
jeremyers1MemberNevermind, I figured it out. This seems to work:
add_filter( 'genesis_after_entry', 'aew_after_page' ); function aew_after_page() { if ( !is_page() ) return; genesis_widget_area( 'after-entry', array( 'before' => '<div class="after-entry widget-area"><div class="wrap">', 'after' => '</div></div>', )); }
Blogger and Author
jeremyers1MemberWhat if I am using a theme other than Metro Pro, and so my functions.php file does not have that function? Is there a genesis function I can use instead?
Blogger and Author
March 18, 2014 at 4:01 pm in reply to: Featured Posts Widget in Magazine Pro Theme acting strange #95566jeremyers1MemberI knew it had to be something simple and silly like that. Two posts were sticky. Thanks!
Blogger and Author
March 18, 2014 at 11:41 am in reply to: Featured Posts Widget in Magazine Pro Theme acting strange #95514jeremyers1Memberjeremyers1Memberbdarazs,
I got it to work by deleting that comma near the end so it looks like this:
add_action( 'genesis_after_entry_content', 'genesis_prev_next_post_nav' );
Now I just need to style it....
Blogger and Author
jeremyers1MemberThanks for the code above by braddalton. Didn't see it before. That worked.
Blogger and Author
September 16, 2013 at 4:56 pm in reply to: How to move date from header entry-meta to footer entry-meta #62899jeremyers1MemberThanks! New to Genesis and didn't know that great plugin existed...
Blogger and Author
jeremyers1MemberI am trying to do this also. I added this to my functions.php file:
function my_page_info() {
$post_info = '[post_date] ' . __( 'by', 'genesis' ) . ' [post_author_posts_link] [post_comments] [post_edit]';
printf( '<p class="entry-meta">%s</p>', do_shortcode( $post_info ) );
}if ( is_page() ) {
add_action( 'genesis_entry_header', 'my_page_info' );
}But nothing is appearing on my pages. Any help?
Blogger and Author
jeremyers1MemberThanks, David.
I am primarily interested in mixins. Maybe I don't need the entire .less framework for this...
But as you say, maybe it is not needed at all, since the Genesis css is pretty straightforward and simple (which is part of its genius).
Blogger and Author
jeremyers1MemberHere is another vote for some sort of indication on the downloads page about whether or not the Child Themes are Genesis 2.0 compliant.
Blogger and Author
-
AuthorPosts