Documentation for be_subpages_page_title filter?
-
Hi Bill. Can you please provide some guidance on using the be_subpages_page_title filter?
I have tried to follow this Alternative link title post, but I can’t get it working.
I have used Advanced Custom Fields to add a meta_key called be_alt_link_title on the postmeta table. I have added an alternative title to a page and can see it in the postmeta table in SQL. I then added the code from your post https://gist.github.com/billerickson/eae1345d8df6c45c47aa to my child theme’s functions.php file:
/** * Alternate Title for Subpages * * @author Bill Erickson * @link https://gist.github.com/billerickson/eae1345d8df6c45c47aa * * @param string $title * @param object $subpage * @return string $title */ function be_subpages_alternate_title( $title, $subpage ) { $alt = esc_attr( get_post_meta( $subpage->ID, 'be_alt_link_title', true ) ); if( $alt ) $title = $alt; return $title; } add_filter( 'be_subpages_page_title', 'be_subpages_alternate_title', 10, 2 );
My expectation is that the title of that page will change in the sidebar and will show the alternative title. But nothing is changing. It is still just showing the full title.
Can you provide guidance for getting that working please?
Thanks!
- The topic ‘Documentation for be_subpages_page_title filter?’ is closed to new replies.