array( // on allow a tags
'href' => array() // and those anchors can only have href attribute
)
);
// Probably a good idea to make sure your data is set
if( isset( $_POST['url'] ) )
update_post_meta( $post_id, 'url', wp_kses( $_POST['url'], $allowed ) );
}
function recentPosts() {
$rPosts = new WP_Query();
$rPosts->query('showposts=3');
while ($rPosts->have_posts()) : $rPosts->the_post(); ?>
)|(\ )|(\ )/", " ", $content);
$content = strip_tags($content);
if(strlen($content) < $size)
return $content;
$content = substr($content, 0, $size);
$spaceloc = strrpos($content, " ");
if($spaceloc)
{
$content = substr($content, 0, $spaceloc);
$content.= "...";
}
return $content;
}
/* a custom callback function that displays a meaningful title
* depending on the page being rendered
*/
function gravity_filter_wp_title($title, $sep, $sep_location) {
// add white space around $sep
$sep = ' ' . $sep . ' ';
$site_description = get_bloginfo('description');
if ($site_description && (is_home() || is_front_page()))
$custom = $sep . $site_description;
elseif(is_category())
$custom = $sep . __('Category', 'gravity');
elseif(is_tag())
$custom = $sep . __('Tag', 'gravity');
elseif(is_author())
$custom = $sep . __('Author', 'gravity');
elseif(is_year() || is_month() || is_day())
$custom = $sep . __('Archives', 'gravity');
else
$custom = '';
// get the page number (main page or an archive)
if(get_query_var('paged'))
$page_number = $sep . __('Page ', 'gravity') . get_query_var('paged');
// get the page number (post with multipages)
elseif(get_query_var('page'))
$page_number = $sep . __('Page ', 'gravity') . get_query_var('page');
else
$page_number = '';
// Comment the 4 lines of code below and see how odd the title format becomes
if($sep_location == 'right' && !(is_home() || is_front_page())) {
$custom = $custom . $sep;
$title = substr($title, 0, -2);
}
// return full title
return get_bloginfo('name') . $custom . $title . $page_number;
} // end of function gravity_filter_wp_title
/* add function 'gravity_filter_wp_title()' to the
* wp_title filter, with priority 10 and 3 args
*/
add_filter('wp_title', 'gravity_filter_wp_title', 10, 3);
function display_images_in_list($size = full) {
if($images = get_posts(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
))) {
foreach($images as $image) {
$attimg = wp_get_attachment_image($image->ID,$size);
echo $attimg;
}
}
}
?>