Articles of posts

WordPress Delete hook with wp_delete_post function?

I have this action/hook: add_action( ‘before_delete_post’, ‘my_delete_function’ ); function my_delete_function($post_id) { global $wpdb; $achievement = get_the_category($post_id); $h = $achievement[0]->cat_ID; $s = ”.str_replace(‘”‘, ”, $h); if ( $s == 6 || $s == 5){ $wpdb->query(“DELETE FROM wp_votes WHERE post = “.$post_id) or die(mysql_error()); } } The above works great when I am deleting posts from the […]

Add link on the top menu of the post table?

Is there any way to add links on the top, as pictured below?

Disable author profile in post

I am managing a WP 3.0.4 site where every post has the profile of the author appended. Where is the setting to disable this?

post re-order on my site

I want to re-order the post ‘Make Enquiry’ on my site so it appears last. Please suggest a way to achieve this. Regards,

Accessing $post variable from template part

Here is a section of code that I have in a template file — to display sub-navigation if the page has child-pages: <?php // display sub-nav if page has children ?> <?php $children = get_pages(array(‘child_of’ => $post->ID)); ?> <?php if (count($children)) : ?> <ul class=”nav nav-tabs”> <?php foreach ($children as $val) : ?> <li role=”presentation”> […]

Edit Post VS Custom Form

I have a blog which relies heavily on user generated content. I would like my users to be able to create posts, but the posts must only have specific fields: title content an attached image two metadata fields (latitude, longitude from Google Maps) tags (only pre-existing tags) Is it better to: a) give users access […]

Automaticly add slug to posts

I’m using a us/news/%postname%/ structure for my permalinks. This works great for regular posts. However, I have a few different custom post types, and I don’t want the us/news part in their slug. How do I have it both ways?

posts_nav_link() not displaying anything

I’m having difficulty getting posts_nav_link() to display anything. Below is my index.php template file, I’m using permalinks (index.php/2011/08/26/sample-post/ format) and I’ve currently got my Blog pages show at most set to -1. Does anyone know why the links aren’t working? index.php <?php get_header(); $args = array(‘posts_per_page’ => 4,’paged’ => get_query_var(‘page’)); $myquery = new WP_Query( $args […]

WordPress post tag & custom field

I have the site in WordPress where I used the custom fields, but now I want to use that custom field as post tag automatically. Can anyone have any idea? Thanks.

While in “the loop”, detect if a post is the most recent

While inside “the loop” in WordPress, is there an easy way to detect if a post is the most recent? A Usage Example: I want to make the first post output an H1 for the title instead of an H2. Or I want the first post to display a thumbnail image (and not the rest). […]