{"id":11071,"date":"2010-11-01T10:51:32","date_gmt":"2010-11-01T10:51:32","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/all-inclusive\/"},"modified":"2022-01-09T07:38:41","modified_gmt":"2022-01-09T07:38:41","slug":"all-inclusive","status":"publish","type":"plugin","link":"https:\/\/ur.wordpress.org\/plugins\/all-inclusive\/","author":740133,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.7","stable_tag":"trunk","tested":"5.8.13","requires":"5.8","requires_php":"","requires_plugins":"","header_name":"All Inclusive","header_author":"stur","header_description":"","assets_banners_color":"bbbbbc","last_updated":"2022-01-09 07:38:41","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/bugacms.com\/wpEn\/all-inclusive\/","header_author_uri":"http:\/\/bugacms.com\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":2974,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":1137844,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[133,683,86,166,1326],"plugin_category":[43,50,52],"plugin_contributors":[86488],"plugin_business_model":[],"class_list":["post-11071","plugin","type-plugin","status-publish","hentry","plugin_tags-image","plugin_tags-meta","plugin_tags-post","plugin_tags-posts","plugin_tags-thumbnail","plugin_category-customization","plugin_category-media","plugin_category-performance","plugin_contributors-stur","plugin_committers-stur"],"banners":{"banner":"https:\/\/ps.w.org\/all-inclusive\/assets\/banner-772x250.png?rev=1137844","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/all-inclusive_bbbbbc.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>The pluginplug-in, with two additional SQL queries, joins the original data sample $wp_query-&gt;posts all meta fields, all files and images, for each image the direct url to small, medium, and large image is formed. There\u2019s no need to use functions the_post_thumbnail  and get_post_meta.<\/p>\n\n<h4>How it works<\/h4>\n\n<p>So let\u2019s say we go to the home page of our blog, WordPress gives us a list of the latest 10 records. Let me remind you these are already in the global object in the array $wp_query-&gt; posts. Let\u2019s begin from creating a list of ID (number of records to which they are stored in the database).<\/p>\n\n<h4>Form the first SQL query:<\/h4>\n\n<ul>\n<li>$query = \"SELECT $wpdb-&gt;posts.* FROM $wpdb-&gt;posts WHERE  $wpdb-&gt;posts.post_parent IN('21','29','30','35','38','42','46','48','49','55') AND $wpdb-&gt;posts.post_parent\nAND $wpdb-&gt;posts.post_type = 'attachment'\";<\/li>\n<\/ul>\n\n<p>A normal translation is \u00abfind all the child entries for entries with the numbers (\u201921 \u2018, \u201929?, \u201930 \u2018, \u201935?, \u201938 \u2018, \u201942?, \u201946 \u2018, \u201948?, \u201949 \u2018, \u201955 \u2018)\u00bb. And the type of records required to be \u00abattachment\u00bb. That is, in short, we find all the files (attachment) which we downloaded for our 10 entries.<\/p>\n\n<p>Again we form a list of ID: the first 10 ID entries and add the ID of files (attachments). Attachments as ordinary records are stored in one table \u2013 wp_posts.<\/p>\n\n<h4>Now we use the function update_meta_cache:<\/h4>\n\n<ul>\n<li>$all_meta = update_meta_cache('post', $ar_all_id);<\/li>\n<\/ul>\n\n<p>$ar_all_id \u2013 here are the original recordings and attachments<\/p>\n\n<p>So everything just gets in the cache and subsequent calls get_post_meta will derive value from the cache. The rest is a matter of technique \u2013 the data must be carefully arranged, not mixing anything up. All meta fields are added to the $post-&gt;meta array, and files into an $post-&gt;files array and files are immediately sorted by number order (when downloading it, you can specify the sort order).\nIn addition, for each file, if it is an image, the full path to the thumbnails is calculated: small (thumbnail), average (medium) and the complete picture (full).<\/p>\n\n<h4>WordPres 4:<\/h4>\n\n<p>The default filter is only connected to the main query using is_main_query().\nDoes not work in is_admin() or is_page().<\/p>\n\n<p><a href=\"http:\/\/bugacms.com\/wpEn\/all-inclusive\/\">Home page<\/a>\n<a href=\"http:\/\/bugacms.com\/wpRu\/all-inclusive\/\">\u0420\u0443\u0441\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430<\/a><\/p>\n\n<h3>A brief Markdown Example<\/h3>\n\n<p><a href=\"http:\/\/bugacms.com\/wpEn\/all-inclusive\/\">More PHP code Examples<\/a>\n<a href=\"http:\/\/bugacms.com\/wpRu\/all-inclusive\/\">\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/a><\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>all-inclusive.php<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<h4>Access to metadata fields recording<\/h4>\n\n<ul>\n<li><code>$post-&gt;meta['meta_name']<\/code> or <code>$post-&gt;meta_name<\/code><\/li>\n<\/ul>\n\n<h4>Get files<\/h4>\n\n<ul>\n<li><code>$post-&gt;files[0]-&gt;attachment_url<\/code> Direct Link<\/li>\n<li><code>$post-&gt;files[0]-&gt;guid<\/code> the first file parameter guid is the same direct link<\/li>\n<\/ul>\n\n<h4>Get images and thumbnail<\/h4>\n\n<ul>\n<li><code>$post-&gt;files[0]-&gt;thumbnail<\/code> First Image Thumbnail<\/li>\n<li><code>$post-&gt;files[1]-&gt;thumbnail<\/code> second file is a miniature<\/li>\n<li><code>$post-&gt;files[2]-&gt;medium<\/code> the third file is the average miniature<\/li>\n<li><code>$post-&gt;files[3]-&gt;full<\/code> fourth file is a complete picture<\/li>\n<\/ul>\n\n<!--section=changelog-->\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial version<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Meta field get through function update_meta_cache()<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<p>metadata fields are available as object properties  $post,\nfor example: $post-&gt;meta_name<\/p>\n\n<h4>1.0.3<\/h4>\n\n<p>fixed bug when creating icons for files:  archives, programs, music, videos ...\nremoved error message when an empty result<\/p>\n\n<h4>1.0.4<\/h4>\n\n<p>Fixed bug when using external plug-in cache<\/p>\n\n<h4>1.0.5<\/h4>\n\n<p>Fixed bug when using external plug-in cache<\/p>\n\n<h4>1.0.6<\/h4>\n\n<p>Works with Wordpress 3.5<\/p>\n\n<h4>1.0.7<\/h4>\n\n<p>Works with Wordpress 5. The default filter is only connected to the main query using <strong>is_main_query()<\/strong>.<\/p>","raw_excerpt":"The pluginplug-in, with two additional SQL queries, joins the original data sample $wp_query-&gt;posts all meta fields, all files and images.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/11071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=11071"}],"author":[{"embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/stur"}],"wp:attachment":[{"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=11071"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=11071"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=11071"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=11071"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=11071"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ur.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=11071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}