Changeset 14164
- Timestamp:
- 12/23/2025 02:18:42 AM (3 months ago)
- File:
-
- 1 edited
-
branches/14.0/src/bp-blogs/bp-blogs-template.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/14.0/src/bp-blogs/bp-blogs-template.php
r13844 r14164 490 490 } 491 491 492 /** 493 * Output the permalink of the current blog in the loop. 494 * 495 * @since 1.0.0 496 */ 492 497 function bp_blog_permalink() { 493 498 echo esc_url( bp_get_blog_permalink() ); 494 499 } 500 /** 501 * Return the permalink of the current blog in the loop. 502 * 503 * @since 1.0.0 504 * 505 * @global BP_Blogs_Template $blogs_template The main blog template loop class. 506 * 507 * @return string 508 */ 495 509 function bp_get_blog_permalink() { 496 510 global $blogs_template; … … 527 541 * Return the name of the current blog in the loop. 528 542 * 543 * @global BP_Blogs_Template $blogs_template The main blog template loop class. 544 * 529 545 * @return string The name of the current blog in the loop. 530 546 */ … … 555 571 * @since 1.7.0 556 572 * 573 * @global BP_Blogs_Template $blogs_template The main blog template loop class. 574 * 557 575 * @return int ID of the current blog in the loop. 558 576 */ … … 586 604 /** 587 605 * Return the description of the current blog in the loop. 606 * 607 * @global BP_Blogs_Template $blogs_template The main blog template loop class. 588 608 * 589 609 * @return string Description of the current blog in the loop. … … 645 665 $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) ); 646 666 $classes = array_merge( $classes, array() ); 647 $retval = 'class="' . join( ' ', $classes ) . '"'; 648 649 return $retval; 667 668 return 'class="' . join( ' ', $classes ) . '"'; 650 669 } 651 670 … … 746 765 ); 747 766 748 $retval = bp_get_blog_latest_post_title(); 767 $retval = bp_get_blog_latest_post_title(); 768 $post_id = bp_get_blog_latest_post_id(); 749 769 750 770 if ( ! empty( $retval ) ) { … … 761 781 /* translators: %s: the title of the latest post */ 762 782 __( 'Latest Post: %s', 'buddypress' ), 763 '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'783 '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval, $post_id ) . '</a>' 764 784 ); 765 785 } else { 766 786 767 787 /** This filter is documented in bp-blogs/bp-blogs-template.php */ 768 $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';788 $retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval, $post_id ) . '</a>'; 769 789 } 770 790 } … … 783 803 784 804 /** 805 * Output the ID of the latest post on the current blog in the loop. 806 * 807 * @since 14.5.0 808 * 809 * @see bp_get_blog_latest_post_id() 810 */ 811 function bp_blog_latest_post_id() { 812 echo bp_get_blog_latest_post_id(); 813 } 814 /** 815 * Return the ID of the latest post on the current blog in the loop. 816 * 817 * @since 14.5.0 818 * 819 * @global BP_Blogs_Template $blogs_template The main blog template loop class. 820 * 821 * @return int 822 */ 823 function bp_get_blog_latest_post_id() { 824 global $blogs_template; 825 826 $latest_post_id = 0; 827 828 if ( 829 ! empty( $blogs_template->blog->latest_post ) 830 && ! empty( $blogs_template->blog->latest_post->ID ) 831 && is_int( $blogs_template->blog->latest_post->ID ) 832 ) { 833 $latest_post_id = $blogs_template->blog->latest_post->ID; 834 } 835 836 /** 837 * Filters the ID of the latest post on the current blog in the loop. 838 * 839 * @since 14.5.0 840 * 841 * @param int $latest_post_id ID of the latest post. 842 */ 843 return (int) apply_filters( 'bp_get_blog_latest_post_id', (int) $latest_post_id ); 844 } 845 846 /** 785 847 * Output the title of the latest post on the current blog in the loop. 786 848 * … … 806 868 $retval = ''; 807 869 808 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) ) 870 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) ) { 809 871 $retval = $blogs_template->blog->latest_post->post_title; 872 } 810 873 811 874 /** … … 834 897 * @since 1.7.0 835 898 * 836 * @global BP_Blogs_Template $blogs_template The main blog template loop class.837 *838 899 * @return string URL of the blog's latest post. 839 900 */ 840 901 function bp_get_blog_latest_post_permalink() { 841 global $blogs_template;842 843 $retval = ''; 844 845 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) )846 $retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );902 $retval = ''; 903 $post_id = bp_get_blog_latest_post_id(); 904 905 if ( ! empty( $post_id ) ) { 906 $retval = add_query_arg( 'p', $post_id, bp_get_blog_permalink() ); 907 } 847 908 848 909 /**
Note: See TracChangeset
for help on using the changeset viewer.