Number of posts per page setting is not working?

This could be caused by a theme or plugin overriding the WordPress settings. You could try enabling the TwentyEleven or TwentyTen theme, as well as disabling any plugins, to see if it works then. If so, you could post which theme you are using (if it’s prebuilt) or which plugins you had to disable to … Read more

In what sequence are the hooks fired when a post is “published”?

What exactly do you mean with “published”? One thing you can try is this : http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/ The script runs in your WordPress root (or in /wp-admin/ if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook, active filters (or actions, they’re the same) are listed … Read more

posts page – different lengths of excerpt

First, you need to filter excerpt_length. Assuming you want your default excerpt length to be 50 words: <?php function wpse53485_filter_excerpt_length( $length ) { return 50; } add_filter( ‘excerpt_length’, ‘wpse53485_filter_excerpt_length’ ); ?> That will make all excerpts 50 words. Make sure that works first. Then, add in an appropriate conditional, to use a different excerpt length … Read more

Delete Child Posts

Try it like this: $args = array( ‘post_parent’ => $parentid, ‘post_type’ => ‘custom-type’ ); $posts = get_posts( $args ); if (is_array($posts) && count($posts) > 0) { // Delete all the Children of the Parent Page foreach($posts as $post){ wp_delete_post($post->ID, true); } } // Delete the Parent Page wp_delete_post($parentid, true);

How to Sort Custom columns in admin

This tutorial from WPTuts+ will do the trick … Quick Tip: Make Your Custom Column Sortable In a recent article by Claudio Simeone, he demonstrated how you could add extra columns to your post, or custom post type, admin screens (or remove existing ones). In this quick tip I build on that by showing you … Read more

Load posts dynamically

Here’s how I’d approach it. Let me know in the comments if you need more detail. 1) Create a template that pulls back your initial page content — the default right panel content and the list of links for the left panel. Ensure the links have post_id set as the value of the id attribute. … Read more

How to programmatically create posts in wordpress?

You can use the wp_insert_post() function to accomplish creating a new post, including it being in a draft state. As you can see in this snippet from the Codex, you can control all the aspects of the post, including post date, draft status, post type, categories, and much more. $post = array( ‘ID’ => [ … Read more

get_the_term_list by hierarchy order

get_the_term_list() will not work here. The best function to use would be wp_get_post_terms() With the following assumption, this can work If a post only belongs to one parent, one child and/or one grandchild, you can order the terms by term_id. It is widely accepted that the parent will have a lower numbered ID than the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)