Created
March 2, 2018 10:52
-
-
Save glueckpress/7fe3bcce5ed5f1bb5f43c7e0d445be15 to your computer and use it in GitHub Desktop.
[WordPress] Function to check if a post (ID) has a more link.
This file contains hidden or 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 | |
/** | |
* Takes a WordPress post ID and checks if the post has a more link. | |
* | |
* @author Caspar Hübinger | |
* @uses get_extended() | |
* @link https://developer.wordpress.org/reference/functions/get_extended/ | |
* | |
* @param int $post_id Post ID | |
* @return boolean True if text exists before more tag, else false | |
*/ | |
function maybe_has_more_link( $post_id ) { | |
$post = get_post( $post_id ); | |
$content = $post->post_content; | |
$data_array = get_extended( $content ); | |
return '' !== $data_array['extended']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://de.wordpress.org/support/topic/inhalt-anzeigen-wenn-post-verwendet/#post-47740