Output Buffer Issue with Single Post View

Most likely, that comments.php file is being included or required more than once. You can make sure that any call to that file is done with include_once or require_once to prevent that issue. Otherwise, a safe workaround would be to wrap the file contents with: if ( ! function_exists( ‘basey_comment’ ) ) : # code … Read more

get last post’s link with SQL query

Assuming each site is WP, they’ll both have RSS feeds. You’re better off just to fetch the RSS feed and get the latest post link from that. WP even has some built in support RSS parsing! <?php /** * An example of how to use fetch feed * * @uses fetch_feed * @return bool|string False … Read more

WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?

You can do that within the loop using wp_get_attachment_image. Something like (not tested): //loop starts //values for get_posts ( or wp query if you prefer) $args = array( ‘post_type’ => ‘attachment’, //gets the attachments aka your images ‘numberposts’ => -1, ‘post_parent’ => $post->ID ); // some attributes you want added to each image $default_attr = … Read more

fetching posts and showing on frontpage

Method 1 (tested): The easiest way that wont even involve any special code is to use wordpress rss feed… i dont know if this is the solution you are after but it looks to be the simplest one i can think of… You can use: feed2js (to build an rss “recent posts” display) There you … Read more

Export all posts to import as product items

You don’t have to export and then re-import, you can do it all via the API in one go, no XML required. here’s a quick example plugin: <?php /* Plugin Name: WPA_convert_types */ function wpa_convert_types_page() { add_management_page( ‘WPA convert types’, ‘WPA convert types’, ‘manage_options’, ‘wpa_convert_types’, ‘wpa_convert_types_render_page’ ); } add_action(‘admin_menu’, ‘wpa_convert_types_page’); function wpa_convert_types_render_page() { if( isset( … Read more

Adjust the order for returned posts

In order to accomplish what you desire, you’ll have to fetch the posts ahead of time. There is no way to specify in SQL an arbitrary ordering given an ID list. query_posts() creates another main query, throwing out the main query. Since you’re doing this anyway, you can use get_posts() to return a list of … Read more