Comments are assigned to wrong or related post
try to add wp_reset_postdata(); after the endwhile; of the ‘related posts’ loop.
try to add wp_reset_postdata(); after the endwhile; of the ‘related posts’ loop.
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
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
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
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);
Shortcodes are supposed to return your html, not echo it. Make sure you check the documentation on the Shortcodes API http://codex.wordpress.org/Shortcode_API
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
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
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() 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