ap_latest_post_activity_html( mixed $post_id = false, integer|boolean $answer_activities = false )
Description #
Get latest activity of question or answer.
Parameters #
- $post_idmixed (Optional) Question or answer ID. Default value: false
- $answer_activitiesinteger | boolean (Optional) Show answers activities as well. Default value: false
Source #
File: includes/qaquery.php
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | function ap_latest_post_activity_html( $post_id = false, $answer_activities = false ) { if ( false === $post_id ) { $post_id = get_the_ID(); } $_post = ap_get_post( $post_id ); $activity = $_post ->activities; if ( false !== $answer_activities && ! empty ( $_post ->activities[ 'child' ] ) ) { $activity = $_post ->activities[ 'child' ]; } if ( ! empty ( $activity ) && ! empty ( $activity [ 'date' ] ) ) { $activity [ 'date' ] = get_gmt_from_date( $activity [ 'date' ] ); } if ( false === $answer_activities && ( ! isset( $activity [ 'type' ] ) || in_array( $activity [ 'type' ], array ( 'new_answer' , 'new_question' ), true ) ) ) { return ; } $html = '' ; if ( $activity ) { $user_id = ! empty ( $activity [ 'user_id' ] ) ? $activity [ 'user_id' ] : 0; $activity_type = ! empty ( $activity [ 'type' ] ) ? $activity [ 'type' ] : '' ; $html .= '<span class="ap-post-history">' ; $html .= '<a href="' . ap_user_link( $user_id ) . '" itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">' . ap_user_display_name( $user_id ) . '</span></a>' ; $html .= ' ' . ap_activity_short_title( $activity_type ); if ( ! empty ( $activity [ 'date' ] ) ) { $html .= ' <a href="' . get_permalink( $_post ) . '">' ; $html .= '<time itemprop="dateModified" datetime="' . mysql2date( 'c' , $activity [ 'date' ] ) . '">' . ap_human_time( $activity [ 'date' ], false ) . '</time>' ; $html .= '</a>' ; } $html .= '</span>' ; } if ( $html ) { return apply_filters( 'ap_latest_post_activity_html' , $html ); } return false; } |
Expand full source code Collapse full source code View on GitHub: includes/qaquery.php:686
Add your comment