Created
November 27, 2014 07:50
-
-
Save pigmentGit/2e7ab03c5b3a73dfcebf to your computer and use it in GitHub Desktop.
Bestämma maxlängd för custom_field
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 $trim_length = 120; //desired length of text to display | |
$custom_field = 'om_omrade'; | |
$value = get_post_meta($post->ID, $custom_field, true); | |
if ($value) { | |
echo rtrim(substr($value,0,$trim_length)) . '...'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment