{"id":4110,"date":"2008-11-25T17:20:40","date_gmt":"2008-11-25T17:20:40","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/get-post\/"},"modified":"2011-06-06T00:43:03","modified_gmt":"2011-06-06T00:43:03","slug":"get-post","status":"publish","type":"plugin","link":"https:\/\/twd.wordpress.org\/plugins\/get-post\/","author":1370922,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.0.0","stable_tag":"2.0.0","tested":"3.1.4","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Get post","header_author":"James Tatum","header_description":"","assets_banners_color":"","last_updated":"2011-06-06 00:43:03","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_s-xclick&hosted_button_id=CG8P46WLYX6LQ","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/get-post\/","header_author_uri":"http:\/\/thelightness.blogspot.com","rating":0,"author_block_rating":0,"active_installs":100,"downloads":14626,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":{"2.0.0":"<p>Many new features including the ability to customize post output, a lot of\nnew available parameters, and more<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1","1.0.2","2.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1538884","resolution":"1","location":"plugin"}},"screenshots":{"1":"Example page showing get-post invoked three times - once to display some\ndates, once to show a link, and once with the default template."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1578,4977,170,86,22882],"plugin_category":[],"plugin_contributors":[83289],"plugin_business_model":[],"class_list":["post-4110","plugin","type-plugin","status-publish","hentry","plugin_tags-display","plugin_tags-latest","plugin_tags-page","plugin_tags-post","plugin_tags-retrieve","plugin_contributors-jtatum","plugin_committers-jtatum"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/get-post.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/get-post\/trunk\/screenshot-1.png?rev=1538884","caption":"Example page showing get-post invoked three times - once to display some\ndates, once to show a link, and once with the default template."}],"raw_content":"<!--section=description-->\n<p>Get Post adds a tag that allows you to retrieve and display the latest post\nidentified by a specific set of parameters.<\/p>\n\n<p>When this plugin is active, any post or page can contain the get-post markup\nas follows:<\/p>\n\n<pre><code>[get-post tag=some-tag]\n<\/code><\/pre>\n\n<p>This will be replaced with the latest post tagged with the given tag.<\/p>\n\n<h4>Parameters<\/h4>\n\n<p>The parameters control which posts are retrieved by get-post. Options can be\nused in combination to build a list of criteria for post or posts to retrieve.\nBy mixing criteria, you can exert a lot of control over the post(s) which are\nfound by the plugin.<\/p>\n\n<pre><code>[get-post tag=some-tag random show=3]\n<\/code><\/pre>\n\n<p>One note on Wordpress in general: if you specify criteria that Wordpress can't\nmatch, it will make something up. For instance, if you specify a tag or\ncategory that doesn't exist, it will simply retrieve the latest post with no\nindication that anything is wrong. Take care to ensure that the options you\nspecify are what you intend.<\/p>\n\n<p>Several of these parameters work best when specifying the slugs. For instance,\nwhen specifying a tag it's best to use the slug value rather than the full\nname of the tag. To find the slug, see the admin panel -&gt; posts -&gt; post tags.\nThe slug is listed right on that page.<\/p>\n\n<p>You may wish to specify an option value with a space in it. This is\naccomplished with quotes:<\/p>\n\n<pre><code>[get-post option=\"a value with spaces\"]\n<\/code><\/pre>\n\n<ul>\n<li><p>tag:\nSpecify a tag to search for. The tag's slug should be specified.<\/p>\n\n<pre><code>[get-post tag=some-tag]\n<\/code><\/pre><\/li>\n<li><p>category:\nSpecify a category to search for. The category's slug should be specified.<\/p>\n\n<pre><code>[get-post category=some-category]\n<\/code><\/pre><\/li>\n<li><p>show:\nSpecify the number of posts to show.<\/p>\n\n<pre><code>[get-post show=5]\n<\/code><\/pre><\/li>\n<li><p>template:\nSpecify the template to use. This specification overrides the template set in\nthe options panel of the admin interface. See the template section for more\ndetails on template tags. <strong>NOTE:<\/strong> If entering any HTML into this, please be\nsure to select the HTML editor rather than the visual editor.<\/p>\n\n<pre><code>[get-post template=\"&lt;h1&gt;Title: {title}&lt;\/h1&gt;\"]\n<\/code><\/pre><\/li>\n<li><p>random:\nSelect a random post from the matching criteria<\/p>\n\n<pre><code>[get-post random]\n<\/code><\/pre><\/li>\n<li><p><em>default<\/em>:\nThis isn't really an option. <em>By default<\/em>, get-post displays the latest blog\npost.<\/p>\n\n<pre><code>[get-post]\n<\/code><\/pre><\/li>\n<\/ul>\n\n<h4>Templates<\/h4>\n\n<p>Get-post ships with a default template that should render the usual post\ndetails in a form that fits well with most themes. You can customize this\ntemplate to add or remove data from the included post. Additionally, you can\nuse the <code>template<\/code> parameter to the <code>[get-post]<\/code> tag to specify a one-off\ntemplate.<\/p>\n\n<p>Using the <code>show<\/code> parameter will retrieve multiple posts. In this case, the\ntemplate will be repeated one time for each retrieved post.<\/p>\n\n<p>These tags are replaced with the value from the retrieved post. For instance,\na template containing <code>{title}<\/code> will actually have the title of the retrieved\npost, rather than the word <code>title<\/code>.<\/p>\n\n<ul>\n<li><p>{title}:\nThe title of the post.<\/p><\/li>\n<li><p>{content}:\nThe content of the post.<\/p><\/li>\n<li><p>{author}:\nThe author of the post.<\/p><\/li>\n<li><p>{date}:\nThe date the post was written.<\/p><\/li>\n<li><p>{time}:\nThe time the post was written.<\/p><\/li>\n<li><p>{permalink}:\nA link to the post itself.<\/p><\/li>\n<li><p>{authorlink}:\nA link to all posts by the post's author.<\/p><\/li>\n<li><p>{id}:\nThe post's ID number.<\/p><\/li>\n<\/ul>\n\n<h4>Examples<\/h4>\n\n<p>Indicate when your blog was last updated:<\/p>\n\n<pre><code>Blog last updated [get-post template=\"{date} at {time}.\"]\n<\/code><\/pre>\n\n<p>Link to the latest post:<\/p>\n\n<pre><code>Check out my post: [get-post template=\"&lt;a href='{permalink}'&gt;{title}&lt;\/a&gt;\"]\n<\/code><\/pre>\n\n<h4>How it works<\/h4>\n\n<p>This plugin does something a little bit unorthodox: It reenters <a href=\"http:\/\/codex.wordpress.org\/The_Loop\">\"The\nLoop\"<\/a> while the post content is being rendered. Then, it calls\nwhatever Wordpress internal functions will safely work, using raw data from\n$post when these functions are unsafe to call again. People curious about the\ninternals should examine <code>class-get-post-getter.php<\/code>. The class is structured\nto be reusable by any other GPL2 projects.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>get-post.php<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Use the [get-post] markup in a post or page<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>2.0.0 5-Jun-2011<\/h4>\n\n<ul>\n<li>Rewrite of internals. The option parser is a lot more powerful. The new\ndesign makes adding new options simpler.<\/li>\n<li>Plugins that affect post content should be correctly rendered now.<\/li>\n<li>To a very limited extent, you can use get-post recursively. (If you do,\nplease email me a link or let me know what you're doing with this.)<\/li>\n<li>Adding several optional parameters to the parser tag - category, tag,\nrandom, show.<\/li>\n<li>Switching to a template system rather than hard-coding the HTML for the post\ndisplay.<\/li>\n<li>Display errors when unknown parameters are specified.<\/li>\n<li>Using the template option, users can output individual elements from posts<\/li>\n<li>Plugin settings are now available in the admin panel. You can edit the\ntemplate used for the tag to make it match your theme here.<\/li>\n<li>Plugin can be uninstalled.<\/li>\n<\/ul>\n\n<h4>1.0.2 13-Jun-2009<\/h4>\n\n<ul>\n<li>Did not update the version number properly in 1.0.1. Oops.<\/li>\n<\/ul>\n\n<h4>1.0.1 13-Jun-2009<\/h4>\n\n<ul>\n<li>Fixed issue where comments and other post data bled over into the \"getter\"\nfrom the \"gotten\" post.<\/li>\n<\/ul>\n\n<h4>1.0.0 25-Nov-2008<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Get Post adds a tag that allows you to retrieve and display the latest post identified by a specific set of parameters.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/4110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=4110"}],"author":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jtatum"}],"wp:attachment":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=4110"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=4110"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=4110"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=4110"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=4110"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=4110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}