WordPress.org

Ready to get started?Download WordPress

Forums

get_post($post, $output) - what does this mean (1 post)

  1. alxvallejo
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic