{"id":649,"date":"2013-06-17T18:12:02","date_gmt":"2013-06-17T18:12:02","guid":{"rendered":"http:\/\/musilda.cz\/?p=649"},"modified":"2013-06-17T18:12:02","modified_gmt":"2013-06-17T18:12:02","slug":"wordpress-query-generator","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/wordpress-query-generator\/","title":{"rendered":"WordPress query generator"},"content":{"rendered":"\n
Na r\u016fzn\u00fdch f\u00f3rech se st\u00e1le dokola opakuj\u00ed dotazy na to jak vypsat \u010dl\u00e1nky v r\u016fzn\u00e9m po\u0159ad\u00ed a podle r\u016fzn\u00fdch parametr\u016f. P\u0159esto\u017ee je v Codexu WP_Query velmi dob\u0159e pops\u00e1na, m\u016f\u017ee b\u00fdt \u010dten\u00ed dokumentace pro n\u011bkoho \u00fanavn\u00e9. Jako perfektn\u00ed pom\u016fcka pro ka\u017ed\u00e9ho, kdo nechce studovat mo\u017enosti funkce v Codexu, je tu perfektn\u00ed pom\u016fcka. <\/p>\n\n\n\n\n\n\n\n
Pomoc\u00ed WordPress query generatoru nastav\u00edte pot\u0159ebn\u00e9 parametry a na n\u011bkolik kliknut\u00ed m\u016f\u017eete vytvo\u0159it r\u016fzn\u00e9 queries. Pokud nen\u00ed WordPress v\u00e1\u0161 denn\u00ed chleba, usnadn\u00ed v\u00e1m tento n\u00e1stroj od Spruce interactive<\/a> pr\u00e1ci. P\u0159esto\u017ee pro pokro\u010dilej\u0161\u00ed dotazy nen\u00ed vhodn\u00fd (neobsahuje mo\u017enost zm\u011bnit post_type), je velk\u00fdm pomocn\u00edkem. V\u00fdsledn\u00fd k\u00f3d m\u016f\u017ee vypadat n\u00e1sledovn\u011b:<\/p>\n\n\n\n$custom_query = new WP_Query(array(\n 'post_status' => 'publish',\n 'post_type' => 'post',\n 'order' => 'ASC',\n 'orderby' => 'none',\n 'posts_per_page' => '10',\n 'offset' => '1',\n 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1\n ));\n<\/pre>\n\n\n\n