Last active
September 6, 2019 17:44
-
-
Save LMNTL/8ced61ac54433b7826d09c02f2690981 to your computer and use it in GitHub Desktop.
Add page numbers to page titles in Member Directory Add On for Paid Memberships Pro
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 | |
/* | |
*/ | |
function my_pmpro_add_directory_page_numbers($title){ | |
global $post, $pmpro_pages; | |
$pn = 0; | |
if( isset($_REQUEST['pn'] ) ) | |
{ | |
$pn = sanitize_text_field( $_REQUEST['pn'] ); | |
} | |
if( ( $post->ID == $pmpro_pages['directory'] ) && $pn > 1 ) | |
{ | |
$title['page'] = "Page " . esc_html( $pn ); | |
} | |
return $title; | |
} | |
function my_add_title_change(){ | |
add_filter("document_title_parts", "my_pmpro_change_directory_title", 999, 1); | |
} | |
add_action("wp", 'my_add_title_change', 999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment