Support » Plugins » Hacks » get_post($post, $output) – what does this mean

  • I’m hacking this plugin Embed Posts, which extracts the content from posts.

    The code for this particular example is:

    function includePosts_get_post_by_slug($post_name, $output = OBJECT){
    	global $wpdb;
    	$post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s", $post_name ));
    	if ( $post ) return get_post($post, $output);
    	return null;

    My goal is to pull the comments using the same plugin. That way I can have pages with breadcrumbs attached and pull posts and comments from certain slugs.

  • The topic ‘get_post($post, $output) – what does this mean’ is closed to new replies.