-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from thenewinquiry/1.1.1
#17 Added ability to customize text used for post description
- Loading branch information
Showing
4 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Tni Core JetPack Customization | ||
* | ||
* @package Tni_Core | ||
* @subpackage Tni_Core\Includes | ||
* @since 1.1.1 | ||
* @license GPL-2.0+ | ||
*/ | ||
|
||
/** | ||
* Custom Description | ||
* Replace `og:description` with `seo_description` custom field, if it exists | ||
* | ||
* If `seo_description` doesn't exist for a post/page, do not modify `og:description`. | ||
* | ||
* @since 1.1.1 | ||
* | ||
* @uses jetpack_open_graph_tags filter | ||
* @uses get_post_meta | ||
* | ||
* @param {array} $tags | ||
* @return {array} $tags | ||
*/ | ||
function tni_core_og_description( $tags ) { | ||
$seo_description = get_post_meta( get_the_id(), 'seo_description', true ); | ||
if( $seo_description ) { | ||
$tags['og:description'] = esc_attr__( $seo_description, 'tni-core' ); | ||
} | ||
return $tags; | ||
} | ||
add_filter( 'jetpack_open_graph_tags', 'tni_core_og_description' ); |
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
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