Adding an Unlinked Space in a Custom Function

In my opinion CSS isn’t the right way, it should be a “real” space. Also there is no class to target the differents links in the string. Try this code: function wp_link_pages_args_prevnext_add($args) { global $page, $numpages, $more, $pagenow; if($page-1) # there is a previous page $args[‘before’] .= ‘ ‘. _wp_link_page($page-1) . $args[‘link_before’] . $args[‘previouspagelink’] . … Read more

Closing WP_LINK_PAGES DIV ID w/After Argmuent

First, declare the after arg at the beginning of your code: $args[‘before’] = ‘<div id=”link_wrap”>’; $args[‘after’] = ‘</div>’; When there is a next page, the arg is overwritten, so you’ll have to add the closing tag at the end: if ($page<$numpages) # there is a next page $args[‘after’] = ‘ ‘. _wp_link_page($page+1) . $args[‘link_before’] . … Read more

Post Views Code Hacks

// Post views function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0 View”; } if ($count == ‘1’) { return $count.’ View’; } else { $count = number_format((int)$count); return $count.’ Views’; } } function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count … Read more

Echo post title in post

Use the_title(): function add_post_content($content) { if(!is_feed() && !is_home()) { $content = the_title( ‘<p>’, ‘</p>’, FALSE ) . $content; } return $content; } add_filter(‘the_content’, ‘add_post_content’); The first two arguments are for $vefore and $after. If a post doesn’t have a title, you get not extra markup. The last argument makes the function returning the string. Otherwise … Read more