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 | |
| // Generating a meta description using standard WP components | |
| function meta_description( $char_limit ) { | |
| $tagline = get_bloginfo ( 'description' ); | |
| $post_object = get_post(); | |
| $excerpt = $post_object->post_excerpt; // Get the raw excerpt, warts (tags) and all. | |
| $content = $post_object->post_content; // Get the raw content. | |
| if ( !empty( $excerpt ) ) { // If there is an excerpt lets use it to generate a meta description | |
| $excerpt_stripped = strip_tags( $excerpt ); // Remove any tags using the PHP function strip_tags. | |
| $excerpt_length = strlen( $excerpt_stripped ); // Now lets count the characters |
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
| function pn_get_attachment_id_from_url( $attachment_url = '' ) { | |
| global $wpdb; | |
| $attachment_id = false; | |
| // If there is no url, return. | |
| if ( '' == $attachment_url ) | |
| return; | |
| // Get the upload directory paths |