Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //-------------------------------------------------
- define('WP_USE_THEMES', false);
- require('../wp-load.php');
- header('Content-type: text/html; charset=utf-8');
- //-------------------------------------------------
- // post types
- //-------------------------------------------------
- echo '<h3>list of blog post types</h3>';
- $post_types = get_post_types (array(),'objects');
- foreach ($post_types as $post_type) {
- echo $post_type->name.'<br/>';
- echo (integer)is_post_type_archive($post_type->name).'<br/>';
- echo (integer)is_post_type_hierarchical($post_type->name).'<br/>';
- //echo get_post_type_archive_link( $post_type->name );
- }
- //-------------------------------------------------
- // post type object
- //-------------------------------------------------
- stdClass Object
- (
- [labels] => stdClass Object
- (
- [name] => Записи
- [singular_name] => Запись
- )
- [description] =>
- [publicly_queryable] => 1
- [exclude_from_search] =>
- [capability_type] => post
- [map_meta_cap] => 1
- [_builtin] => 1
- [_edit_link] => post.php?post=%d
- [hierarchical] =>
- [public] => 1
- [rewrite] =>
- [has_archive] =>
- [query_var] =>
- [register_meta_box_cb] =>
- [taxonomies] => Array
- (
- )
- [show_ui] => 1
- [menu_position] =>
- [menu_icon] =>
- [can_export] => 1
- [show_in_nav_menus] => 1
- [show_in_menu] => 1
- [show_in_admin_bar] => 1
- [delete_with_user] => 1
- [name] => post
- [cap] => stdClass Object
- (
- [edit_post] => edit_post
- )
- [label] => Записи
- )
- //-------------------------------------------------
- // categories
- //-------------------------------------------------
- $cats = get_categories('hide_empty=0');
- $args = array('child_of'=>38);
- $args = array('parent'=>38);
- $args = array('parent'=>0);
- $args = array('orderby'=>'slug'/*id, name, count, term_group*/);
- $args = array('order'=>'desc');
- $args = array('hierarchical '=>0);
- $args = array('exclude'=>'1,24');
- $args = array('include'=>'1,24');
- $args = array('number'=>4);
- $cats = get_categories($args);
- foreach ($cats as $cat) {
- echo '<pre>'.print_r($cat,true).'</pre>';
- }
- $cats = get_all_category_ids();
- $cats = get_cat_id('Портфолио');
- $cats = get_cat_name(24);
- $cats = get_category(24, ARRAY_A);
- $cats = get_category_by_path('lessons', true, ARRAY_A);
- $cats = get_category_by_slug('lessons');
- $cat = get_the_category_by_ID(38);
- $cats = get_category_link(38);
- $cats = get_category_parents(24 , true , '>>', true);
- echo htmlentities($cats);
- echo $cats;
- $cats = get_ancestors(array('object_id'=>24,'object_type'=>'category')); //??
- $posts = get_posts('numberposts=4');
- foreach ($posts as $post ){
- $cats = get_the_category();
- print_r($cats);
- echo '<br/>';
- }
- $cats = single_cat_title('>> ', false);
- echo in_category('Разное', 694);
- echo in_category(array('Разное','Блог'), 694);
- the_category ('>> ', 'single', 694);
- the_category ('>> ', 'multiple', 694);
- echo (string)!function_exists('wp_category_checklist');
- //----------------------------------
- $args = array ('hierarchical'=>0);
- $args = array ('order'=>'DESC');
- $args = array ('show_count'=>1);
- $args = array ('hide_empty'=>false);
- $args = array ('use_desc_for_title'=>false);
- $args = array ('child_of'=>38);
- $args = array ('exclude'=>'38,24');
- $args = array ('exclude_tree'=>'38'); //??
- $args = array ('include'=>'38,24');
- $args = array ('number'=>4);
- $args = array ('depth'=>1);
- $args = array ('pad_counts'=>1);
- $args = array ('taxonomy'=>'category');
- // walker
- wp_list_categories($args);
- //----------------------------------
- //-------------------------------------------------
- // category object
- //-------------------------------------------------
- stdClass Object
- (
- [term_id] => 40
- [name] => Портфолио
- [slug] => portfolio
- [term_group] => 0
- [term_order] => 0
- [term_taxonomy_id] => 44
- [taxonomy] => category
- [description] =>
- [parent] => 0
- [count] => 2
- [cat_ID] => 40
- [category_count] => 2
- [category_description] =>
- [cat_name] => Портфолио
- [category_nicename] => portfolio
- [category_parent] => 0
- )
- //-------------------------------------------------
- // tags
- //-------------------------------------------------
- $args = array('orderby'=>'');
- $args = array('orderby'=>'name','order'=>'DESC');
- $args = array('hide_empty'=>false);
- $args = array('exclude'=>'29,31');
- $args = array('include'=>'29,31');
- $args = array('number'=>4);
- $args = array('offset'=>4);
- $args = array('fields'=>'ids');
- $args = array('fields'=>'names');
- $args = array('slug'=>'JQuery');
- $args = array('search'=>'J');
- $args = array('name__like'=>'J');
- $args = array('pad_counts'=>true);
- $args = array('get'=>'all');
- $args = array('child_of'=>0);
- $args = array('parent'=>0);
- $tags = get_tags($args);
- foreach ($tags as $tag) {
- echo '<pre>'.print_r($tag,true).'</pre>';
- }
- $tag = get_tag(20, ARRAY_A);
- echo '<pre>'.print_r($tag,true).'</pre>';
- $tag = get_tag_link(20);
- //------------------------------
- query_posts(array('numberposts'=>1, 'posts_per_page'=>1, 'cat'=>get_cat_id('Разное')));
- while (have_posts()) {
- the_post();
- echo get_the_title().'<br/>';
- echo get_the_tag_list ('<ul><li>','</li><li>','</li></ul>');
- print_r (get_the_tags ());
- }
- //------------------------------
- //-------------------------------------------------
- // tag object
- //-------------------------------------------------
- stdClass Object
- (
- [term_id] => 20
- [name] => Javascript
- [slug] => javascript
- [term_group] => 0
- [term_order] => 0
- [term_taxonomy_id] => 20
- [taxonomy] => post_tag
- [description] => Javascript
- [parent] => 0
- [count] => 6
- )
- //-------------------------------------------------
- // taxonomies
- //-------------------------------------------------
- $taxz = get_taxonomies(array(), 'objects');
- foreach ($taxz as $tax) {
- echo '<pre>'.print_r($tax,true).'</pre>';
- }
- //--------------------------
- $args = array ('orderby'=>'count');
- $args = array ('orderby'=>'count','order'=>'ASC');
- $args = array ('hide_empty'=>false);
- $args = array ('exclude'=>array(40,39));
- $args = array ('include'=>array(40,39));
- $args = array ('exclude_tree'=>array(38));
- $args = array ('number'=>4);
- $args = array ('fields'=>'names');
- $args = array ('fields'=>'ids');
- $args = array ('fields'=>'id=>parent');
- $args = array ('hierarchical'=>false);
- $args = array ('child_of'=>38);
- $args = array ('name__like'=>'J');
- $args = array ('pad_counts'=>true);
- $args = array ('offset'=>4);
- $args = array ('search'=>'j');
- $terms = get_terms('category', $args);
- foreach ($terms as $term) {
- echo '<pre>'.print_r($term,true).'</pre>';
- }
- //--------------------------
- $inf = get_term(40,'category');
- $inf = get_term_by('slug','primary_dir', 'direction', ARRAY_A);
- echo '<pre>'.print_r($inf,true).'</pre>';
- $inf = get_term_by('slug','lessons', 'category', OBJECT);
- $infc = get_term_children ($inf->term_id, 'category');
- echo '<pre>'.print_r($infc,true).'</pre>';
- echo get_term_link( 40, 'category');
- echo (integer)taxonomy_exists('direction');
- echo (integer)taxonomy_exists('category');
- echo (integer)term_exists('portfolio','category');
- echo (integer)term_exists('jquery','category','lessons');
- //-------------------------------------------------
- // taxonomy object
- //-------------------------------------------------
- stdClass Object
- (
- [hierarchical] => 1
- [update_count_callback] =>
- [rewrite] => Array
- (
- [slug] => direction
- [with_front] => 1
- [hierarchical] =>
- [ep_mask] => 0
- )
- [query_var] => direction
- [public] => 1
- [show_ui] => 1
- [show_tagcloud] => 1
- [_builtin] =>
- [labels] => stdClass Object
- (
- [name] => Direction
- [singular_name] => Direction
- [search_items] => Поиск рубрик
- [popular_items] =>
- [all_items] => Direction
- [parent_item] => Родительская рубрика
- [parent_item_colon] => Родительская рубрика:
- [edit_item] => Изменить рубрику
- [view_item] => Просмотреть рубрику
- [update_item] => Обновить рубрику
- [add_new_item] => Добавить новую рубрику
- [new_item_name] => Название новой рубрики
- [separate_items_with_commas] =>
- [add_or_remove_items] =>
- [choose_from_most_used] =>
- [menu_name] => Direction
- [name_admin_bar] => Direction
- )
- [show_in_nav_menus] => 1
- [label] => Direction
- [cap] => stdClass Object
- (
- [manage_terms] => manage_categories
- [edit_terms] => manage_categories
- [delete_terms] => manage_categories
- [assign_terms] => edit_posts
- )
- [name] => direction
- [object_type] => Array
- (
- [0] => digest
- )
- )
- //-------------------------------------------------
- // term object
- //-------------------------------------------------
- stdClass Object
- (
- [term_id] => 40
- [name] => Портфолио
- [slug] => portfolio
- [term_group] => 0
- [term_order] => 0
- [term_taxonomy_id] => 44
- [taxonomy] => category
- [description] =>
- [parent] => 0
- [count] => 2
- )
- //-------------------------------------------------
- // pages
- //-------------------------------------------------
- $args = array('sort_column'=>'post_title','sort_order'=>'ASC');
- $args = array('hierarchical'=>0);
- $args = array('exclude'=>array(299));
- $args = array('include'=>array(299));
- $args = array('child_of'=>0);
- $args = array('parent'=>0);
- $args = array('exclude_tree'=>0);
- $args = array('meta_key'=>'position','meta_value'=>'featured');
- $args = array('meta_key'=>'_wp_page_template');
- $args = array('authors'=>'dmkim1');
- $args = array('number'=>4);
- $args = array('offset'=>4);
- $args = array('post_status'=>'publish');
- $pages = get_pages($args);
- foreach ($pages as $page) {
- echo '<pre>'.print_r($page,true).'</pre>';
- }
- //-----------------------
- $ids = get_all_page_ids();
- echo '<pre>'.print_r($ids,true).'</pre>';
- $page_id = 43;
- $inf = get_page($page_id);
- echo '<pre>'.print_r($inf,true).'</pre>';
- echo get_page_link(43);
- $inf = get_page_by_path('контакты', OBJECT);
- $inf = get_page_by_title('contacts', OBJECT);
- echo get_page_uri($inf->ID);
- //------------------------
- $args = array(
- 'depth' => 0,
- 'show_date' => '',
- 'date_format' => get_option('date_format'),
- 'child_of' => 0,
- 'exclude' => '',
- 'include' => '',
- 'title_li' => __('Pages'),
- 'echo' => 1,
- 'authors' => '',
- 'sort_column' => 'menu_order, post_title',
- 'link_before' => '',
- 'link_after' => '',
- 'walker' => '',
- 'post_type' => 'page',
- 'post_status' => 'publish'
- );
- wp_list_pages($args);
- //------------------------
- $args = array(
- 'depth' => 0,
- 'sort_column' => 'menu_order, post_title',
- 'menu_class' => 'menu',
- 'include' => '',
- 'exclude' => '',
- 'echo' => true,
- 'show_home' => false,
- 'link_before' => '',
- 'link_after' => '' );
- wp_page_menu($args);
- //-------------------------------------------------
- // page object
- //-------------------------------------------------
- stdClass Object
- (
- [ID] => 43
- [post_author] => 1
- [post_date] => 2013-02-28 15:21:53
- [post_date_gmt] => 2013-02-28 11:21:53
- [post_content] =>
- [post_title] => front_page
- [post_excerpt] =>
- [post_status] => publish
- [comment_status] => open
- [ping_status] => open
- [post_password] =>
- [post_name] => front_page
- [to_ping] =>
- [pinged] =>
- [post_modified] => 2013-02-28 15:21:53
- [post_modified_gmt] => 2013-02-28 11:21:53
- [post_content_filtered] =>
- [post_parent] => 0
- [guid] => http://dmkim1.bget.ru/?page_id=43
- [menu_order] => 0
- [post_type] => page
- [post_mime_type] =>
- [comment_count] => 0
- [ancestors] => Array
- (
- )
- [filter] => raw
- )
- //-------------------------------------------------
- // comments
- //-------------------------------------------------
- $args = array('status'=>'approve');
- $args = array('orderby'=>'comment_ID','order'=>'DESC');
- $args = array('offset'=>0,'number'=>1);
- $args = array('post_id'=>623);
- $args = array('user_id'=>1);
- $comments = get_comments($args);
- foreach ($comments as $comm) {
- echo '<pre>'.print_r($comm,true).'</pre>';
- }
- //-------------------------
- while (have_posts()) {
- the_post();
- $inf = get_post(get_the_id());
- if ($inf->comment_count==0)
- continue;
- echo '<h2>'.get_the_title().'</h2><br/>';
- echo (integer)have_comments().'<br/>';
- comments_number( 'no responses', 'one response', '% responses' );
- echo '<br/>';
- $comms = get_comments (array('post_id'=>get_the_id()));
- $comms = get_approved_comments (get_the_id());
- foreach ($comms as $comm) {
- echo get_avatar($comm, 32).'<br/>';
- echo get_comment_author($comm->comment_ID).'<br/><br/>';
- echo get_comment_text($comm->comment_ID).'<br/><br/>';
- }
- }
- //-------------------------
- $num = 30415;
- $inf = get_comment($num);
- echo '<pre>'.print_r($inf,true).'</pre>';
- //-------------------------------------------------
- // comment object
- //-------------------------------------------------
- stdClass Object
- (
- [comment_ID] => 30415
- [comment_post_ID] => 623
- [comment_author] => Дмитрий
- [comment_author_email] => susanyn@mail.ru
- [comment_author_url] =>
- [comment_author_IP] => 109.188.124.180
- [comment_date] => 2013-05-10 16:12:40
- [comment_date_gmt] => 2013-05-10 14:12:40
- [comment_content] => test4
- [comment_karma] => 0
- [comment_approved] => 1
- [comment_agent] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
- [comment_type] =>
- [comment_parent] => 30414
- [user_id] => 1
- )
- //-------------------------------------------------
- // query_posts
- //-------------------------------------------------
- query_vars=
- Array
- (
- [cat] => 40
- [error] =>
- [m] => 0
- [p] => 0
- [post_parent] =>
- [subpost] =>
- [subpost_id] =>
- [attachment] =>
- [attachment_id] => 0
- [name] =>
- [static] =>
- [pagename] =>
- [page_id] => 0
- [second] =>
- [minute] =>
- [hour] =>
- [day] => 0
- [monthnum] => 0
- [year] => 0
- [w] => 0
- [category_name] => portfolio
- [tag] =>
- [tag_id] =>
- [author_name] =>
- [feed] =>
- [tb] =>
- [paged] => 0
- [comments_popup] =>
- [meta_key] =>
- [meta_value] =>
- [preview] =>
- [s] =>
- [sentence] =>
- [fields] =>
- [category__in] => Array
- (
- [0] => 40
- )
- [category__not_in] => Array
- (
- )
- [category__and] => Array
- (
- )
- [post__in] => Array
- (
- )
- [post__not_in] => Array
- (
- )
- [tag__in] => Array
- (
- )
- [tag__not_in] => Array
- (
- )
- [tag__and] => Array
- (
- )
- [tag_slug__in] => Array
- (
- )
- [tag_slug__and] => Array
- (
- )
- [ignore_sticky_posts] =>
- [suppress_filters] =>
- [cache_results] => 1
- [update_post_term_cache] => 1
- [update_post_meta_cache] => 1
- [post_type] =>
- [posts_per_page] => 7
- [nopaging] =>
- [comments_per_page] => 50
- [no_found_rows] =>
- [order] => DESC
- )
- //-------------------------------------------------
- $args = array('cat'=>40);
- $args = array('cat'=>-40);
- $args = array('author'=>1);
- $args = array('author'=>'1,4');
- $args = array('author_name'=>'susanyn1975');
- $args = array('author'=>'-1');
- $args = array('cat'=>40);
- $args = array('category_name'=>'portfolio');
- //---------------------
- $args = array('category__in'=>get_cat_id('Портфолио'));
- $args = array('category__in'=>array(get_cat_id('Уроки'),get_cat_id('PHP')));
- $args = array('category__in'=>array(get_cat_id('PHP')));
- $args = array('cat'=>'38,40');
- $args = array('category_name'=>'portfolio,PHP');
- $args = array('cat'=>'-40');
- $args = array('category__and'=>array(get_cat_id('Уроки'),get_cat_id('PHP')));
- $args = array('category__and'=>array(get_cat_id('JQuery'),get_cat_id('PHP')));
- $args = array('category__in'=>array(get_cat_id('JQuery'),get_cat_id('PHP')));
- $args = array('category__not_in'=>array(get_cat_id('JQuery'),get_cat_id('PHP')));
- //---------------------
- $args = array('tag_id'=>29);
- $args = array('tag'=>'jquery,ajax');
- $args = array('tag'=>'jquery+ajax');
- $args = array('tag__and'=>array(26,35));
- $args = array('tag__in'=>array(26,35));
- $args = array('tag__not_in'=>array(26,35));
- //---------------------
- $args = array('post_type'=>'digest');
- $args = array('post_type'=>'digest', 'direction'=>'primary_dir');
- $args = array('post_type'=>'digest',
- 'tax_query'=>array('taxonomy'=>'direction','field'=>'slug','terms'=>'secondary_dir'));
- //---------------------
- $args = array ('post_type'=>'post', 'posts_per_page'=>400,
- 'tax_query' => array ('relation'=>'OR',
- array('taxonomy'=>'category','field'=>'slug','terms'=>array('php')),
- array('taxonomy'=>'category','field'=>'slug','terms'=>array('jquery'))));
- //---------------------
- $args = array('s'=>'слайдшоу');
- //---------------------
- $args = array('page_id'=>299);
- $args = array('p'=>738);
- $args = array('pagename'=>'контакты');
- $args = array('post_parent'=>0);
- //---------------------
- $args = array('post_type'=>'page', 'post__in'=>array(299));
- $args = array('post_type'=>'page', 'post__not_in'=>array(299));
- $args = array('post_type'=>array('post','page','digest'), 'posts_per_page'=>400);
- //---------------------
- $args = array('post_status'=>'draft');
- $args = array('post_status'=>array('pending','draft'));
- $args = array('post_status'=>'any','post_type'=>'attachment');
- //---------------------
- $args = array('posts_per_page'=>-1);
- $args = array('nopaging'=>true);
- $args = array('offset'=>4);
- $args = array('paged'=>4);
- //---------------------
- $args = array('orderby'=>'title','order'=>'ASC');
- $args = array('orderby'=>'ID','order'=>'ASC');
- $args = array('orderby'=>'author','order'=>'ASC');
- $args = array('orderby'=>'name','order'=>'ASC');
- $args = array('orderby'=>'date','order'=>'ASC');
- $args = array('orderby'=>'modified','order'=>'DESC');
- $args = array('orderby'=>'parent','order'=>'ASC');
- $args = array('orderby'=>'rand');
- $args = array('orderby'=>'comment_count','order'=>'DESC');
- args = array('post_type'=>'page', 'orderby'=>'menu_order','order'=>'ASC');
- $args = array('meta_key'=>'_oxygen_post_location', 'orderby'=>'meta_value','order'=>'ASC');
- $args = array('orderby'=>'author title','order'=>'ASC');
- //---------------------
- $args = array('year'=>$date['year']);
- $args = array('year'=>$date['year'], 'monthnum'=>$date['month']);
- $args = array('year'=>$date['year'], 'monthnum'=>$date['month'], 'day'=>$date['mday']);
- //---------------------
- $week = date('W');
- $year = date('Y');
- $args = array('year'=>$year, 'w'=>$week);
- $args = array('year'=>2012, 'monthnum'=>6);
- //---------------------
- $args = array('meta_key'=>'_oxygen_post_location');
- $args = array('meta_key'=>'_oxygen_post_location', 'meta_value'=>'featured');
- $args = array('meta_value'=>'featured');
- $args = array('meta_key'=>'_oxygen_post_location', 'meta_value'=>'featured',
- 'meta_compare'=>'!=');
- //---------------------
- $args = array('meta_query'=>array (
- array(
- 'key'=>'_oxygen_post_location',
- 'value'=>'featured')
- ));
- //---------------------
- $args = array('meta_query'=>array (
- 'relation'=>'OR',
- array(
- 'key'=>'_oxygen_post_location',
- 'value'=>'featured'),
- array(
- 'key'=>'_oxygen_post_location',
- 'value'=>'featured',
- 'compare'=>'!=')
- ));
- //---------------------
- $args = array('perm'=>'readable');
- //-------------------------------------------------
- $q = new WP_Query($args);
- print_r($q->post_count);
- while ($q->have_posts()) {
- $q->next_post();
- echo '<pre>'.print_r($q->post,true).'</pre>';
- }
- //-------------------------------------------------
- $q = new WP_Query($args);
- echo 'query='.print_r($q->query, true).'<br/>';
- //echo 'query_vars=<pre>'.print_r($q->query_vars, true).'</pre>';
- echo 'queried_object = '.$q->queried_object.'<br/>';
- echo 'queried_object_id = '.$q->queried_object_id.'<br/>';
- echo 'post_count = '.$q->post_count.'<br/>';
- echo 'found_posts = '.$q->found_posts.'<br/>';
- echo 'max_num_pages = '.$q->max_num_pages.'<br/>';
- /*
- $is_single, $is_page, $is_archive, $is_preview, $is_date, $is_year, $is_month, $is_time, $is_author, $is_category, $is_tag, $is_tax, $is_search, $is_feed, $is_comment_feed, $is_trackback, $is_home, $is_404, $is_comments_popup, $is_admin, $is_attachment, $is_singular, $is_robots, $is_posts_page, $is_paged
- */
- while ($q->have_posts()) {
- $q->the_post();
- echo 'current_post = '.$q->current_post.'<br/>';
- echo get_the_title().'<br/>';
- $inf = &get_children(get_the_id());
- //echo '<pre>'.print_r ($inf, true).'</pre>';
- //echo print_r(get_extended(get_the_content()),true).'<br/>';
- $z = get_next_post();
- echo 'next='.$z->title.'<br/>';
- $z = get_previous_post();
- echo 'previous='.$z->title.'<br/>';
- $z = get_adjacent_post();
- echo 'adjacent='.$z->title.'<br/>';
- $z = get_boundary_post();
- echo 'boundary='.$z->title.'<br/>';
- echo get_permalink().'<br/>';
- echo get_the_excerpt().'<br/>';
- echo (string)has_post_thumbnail(get_the_id()).'<br/>';
- //echo get_the_post_thumbnail(get_the_id(),'thumbnail').'<br/>';
- echo print_r(get_post_ancestors(get_the_id()),true).'<br/>';
- echo get_post_mime_type(get_the_id()).'<br/>';
- echo get_post_status(get_the_id()).'<br/>';
- echo get_post_format(get_the_id()).'<br/>';
- echo get_edit_post_link(get_the_id()).'<br/>';
- echo get_delete_post_link(get_the_id()).'<br/>';
- echo print_r(get_the_category(get_the_id()),true).'<br/>';
- echo print_r(get_the_tags(get_the_id()),true).'<br/>';
- echo get_the_time('d.m:Y H:i:s', get_the_id()).'<br/>';
- echo get_the_date('d.m:Y H:i:s', get_the_id()).'<br/>';
- $y = get_the_time('Y', get_the_id());
- $m = get_the_time('m', get_the_id());
- $d = get_the_time('d', get_the_id());
- echo get_day_link ($y, $m, $d).'<br/>';
- echo get_month_link ($y, $m).'<br/>';
- echo get_year_link ($y, $m).'<br/>';
- $types = get_post_types(get_the_id(),'objects');
- echo '<pre>'.print_r($types, true).'</pre>';
- echo get_post_type(get_the_id()).'<br/>';
- $flds = get_post_custom(get_the_id());
- $flds = get_post_custom_keys(get_the_id());
- echo '<pre>'.print_r($flds,true).'</pre>';
- echo get_post_meta(get_the_id(), '_oxygen_post_location', true).'<br/>';
- //----------------------
- echo get_the_term_list(get_the_id(),'category','<ul><li>','</li><li>','</li></ul>');
- echo '<pre>'.print_r( get_the_terms(get_the_id(),'category') ,true).'</pre>';
- $terms = wp_get_object_terms(get_the_id(),'category');
- }
- //-------------------------------------------------
- // post object
- //-------------------------------------------------
- stdClass Object
- (
- [ID] => 738
- [post_author] => 1
- [post_date] => 2013-05-10 13:38:24
- [post_date_gmt] => 2013-05-10 11:38:24
- [post_content] =>
- Страница плагина
- [post_title] => Плагин для агрегации RSS лент DK RSS Digest
- [post_excerpt] =>
- [post_status] => publish
- [comment_status] => open
- [ping_status] => closed
- [post_password] =>
- [post_name] => %d0%bf%d0%bb%d0%b0%d0%b3%d0%b8%d0%bd-%d0%b4%d0%bb%d1%8f-%d0%b0%d0%b3%d1%80%d0%b5%d0%b3%d0%b0%d1%86%d0%b8%d0%b8-rss-%d0%bb%d0%b5%d0%bd%d1%82-dk-rss-digest
- [to_ping] =>
- [pinged] =>
- [post_modified] => 2013-05-10 13:42:57
- [post_modified_gmt] => 2013-05-10 11:42:57
- [post_content_filtered] =>
- [post_parent] => 0
- [guid] => http://kimdm79.hostenko.com/?p=738
- [menu_order] => 0
- [post_type] => post
- [post_mime_type] =>
- [comment_count] => 0
- [filter] => raw
- //-------------------------------------------------
- // attachments
- //-------------------------------------------------
- $posts = get_posts('posts_per_page=5');
- foreach ($posts as $post) {
- setup_postdata($post);
- echo get_the_title().'<br/>';
- $att = & get_children (array('post_type'=>'attachment','post_parent'=>get_the_id()));
- foreach ($att as $attt) {
- echo (integer)wp_attachment_is_image($attt->ID).'<br/>';
- echo get_attached_file($attt->ID).'<br/><br/>';
- echo htmlentities( wp_get_attachment_image($attt->ID, 'medium')).'<br/><br/>';
- echo htmlentities(wp_get_attachment_link($attt->ID, 'medium')).'<br/><br/>';
- echo htmlentities(wp_get_attachment_link($attt->ID, 'medium', true)).'<br/><br/>';
- echo htmlentities(wp_get_attachment_link($attt->ID, 'medium', true,
- false, 'link to image')).'<br/><br/>';
- $inf = wp_get_attachment_image_src($attt->ID, 'large');
- echo '<pre>'.print_r($inf, true).'</pre>';
- $inf = wp_get_attachment_metadata($attt->ID);
- //echo '<pre>'.print_r($inf, true).'</pre>';
- echo wp_get_attachment_thumb_file($attt->ID).'<br/><br/>';
- echo wp_get_attachment_thumb_url($attt->ID).'<br/><br/>';
- echo wp_get_attachment_url($attt->ID).'<br/><br/>';
- }
- }
- //-------------------------------------------------
- // attachment object
- //-------------------------------------------------
- stdClass Object
- (
- [ID] => 112
- [post_author] => 1
- [post_date] => 2012-03-26 10:27:20
- [post_date_gmt] => 2012-03-26 08:27:20
- [post_content] =>
- [post_title] => IMG_5815
- [post_excerpt] =>
- [post_status] => inherit
- [comment_status] => open
- [ping_status] => open
- [post_password] =>
- [post_name] => img_5815
- [to_ping] =>
- [pinged] =>
- [post_modified] => 2012-03-26 10:27:20
- [post_modified_gmt] => 2012-03-26 08:27:20
- [post_content_filtered] =>
- [post_parent] => 0
- [guid] => http://kimdm79.hostenko.com/wp-content/uploads/IMG_5815.jpg
- [menu_order] => 0
- [post_type] => attachment
- [post_mime_type] => image/jpeg
- [comment_count] => 0
- [filter] => raw
- )
- //-------------------------------------------------
- // attachment meta
- //-------------------------------------------------
- Array
- (
- [width] => 993
- [height] => 575
- [hwstring_small] => height='74' width='128'
- [file] => chase.png
- [sizes] => Array
- (
- [thumbnail] => Array
- (
- [file] => chase-145x145.png
- [width] => 145
- [height] => 145
- ),
- [big] => Array
- (
- [file] => chase-546x387.png
- [width] => 546
- [height] => 387
- )
- )
- [image_meta] => Array
- (
- [aperture] => 0
- [credit] =>
- [camera] =>
- [caption] =>
- [created_timestamp] => 0
- [copyright] =>
- [focal_length] => 0
- [iso] => 0
- [shutter_speed] => 0
- [title] =>
- )
- //-------------------------------------------------
- // get_posts
- //-------------------------------------------------
- $args = array('numberposts'=>300, 'posts_per_page'=>300);
- $args = array('offset'=>4);
- $args = array('category'=>40);
- $args = array('orderby'=>'title','order'=>'ASC');
- $args = array('include'=>'748,647');
- $args = array('exclude'=>'748,647');
- $args = array('meta_key'=>'_oxygen_post_location');
- $args = array('meta_key'=>'_oxygen_post_location', 'meta_value'=>'featured');
- $args = array('post_type'=>'attachment');
- $args = array('post_mime_type'=>'image');
- $args = array('post_parent'=>40);
- $args = array('post_status'=>'draft');
- $posts = get_posts($args);
- foreach ($posts as $p) {
- echo $p->post_title.'<br/>';
- echo print_r(get_the_category($p->ID)).'<br/><br/>';
- echo print_r(get_post_meta($p->ID)).'<br/><br/>';
- }
- //-----------------
- $posts = get_posts('posts_per_page=5');
- foreach ($posts as $post) {
- setup_postdata($post);
- echo get_the_title().'<br/>';
- echo get_permalink().'<br/>';
- echo get_the_excerpt().'<br/>';
- echo get_the_date('d.m.Y H:i:s', get_the_id()).'<br/>';
- echo get_the_term_list(get_the_id(),'category','<ul><li>','</li><li>','</li></ul>');
- echo get_the_tag_list('<ul><li>','</li><li>','</li></ul>');
- echo get_the_author().'<br/>';
- //-------------------------------------------------
- // users
- //-------------------------------------------------
- echo (integer)is_user_logged_in().'<br/>';
- //---------------------
- $args = array('redirect'=>site_url());
- $args = array('form_id'=>'zcustom_form');
- $args = array('label_username'=>'Input user name');
- $args = array('label_password'=>'Input password');
- $args = array('label_remember'=>'remember credentials');
- $args = array('label_log_in'=>'go');
- $args = array('id_username' => 'user_login',
- 'id_password' => 'user_pass',
- 'id_remember' => 'rememberme',
- 'id_submit' => 'wp-submit');
- $args = array('remember'=>false);
- $args = array('value_username'=>'admin');
- $args = array('value_remember'=>true);
- wp_login_form($args);
- //---------------------
- $cnt = count_users();
- echo '<pre>'.print_r($cnt,true).'</pre>';
- Array
- (
- [total_users] => 25
- [avail_roles] => Array
- (
- [administrator] => 1
- [subscriber] => 24
- )
- )
- //---------------------
- $args = array('role'=>'administrator');
- $args = array('orderby'=>'display_name','order'=>'ASC');
- $args = array('orderby'=>'user_registered','order'=>'DESC');
- $args = array('offset'=>4);
- $args = array('search'=>'*mail*');
- $args = array('number'=>4);
- $users = get_users($args);
- foreach ($users as $user) {
- echo $user->display_name.'<br/>';
- echo count_user_posts($user->ID).'<br/>';
- $meta = get_user_meta($user->ID);
- $meta = get_the_author_meta('user_firstname', $user->ID);
- echo '<pre>'.print_r($meta,true).'</pre>';
- }
- //---------------------
- echo (integer)email_exists('test@gmail.com');
- $user = get_user_by('slug', 'dmkim1');
- $user = get_userdata(1);
- echo (integer)username_exists('dmkim1');
- echo get_author_posts_url(1);
- //---------------------
- $creds = array();
- $creds['user_login'] = 'dmkim1';
- $creds['user_password'] = '';
- $creds['remember'] = true;
- $user = wp_signon( $creds, false );
- if ( is_wp_error($user) )
- echo $user->get_error_message();
- echo get_current_user_id().'<br/>';
- global $current_user;
- get_currentuserinfo();
- //$current_user = wp_get_current_user();
- echo '<pre>'.print_r($current_user,true).'</pre>';
- //-------------------------------------------------
- // user object
- //-------------------------------------------------
- [0] => stdClass Object
- (
- [ID] => 9
- [user_login] => AntunaKatt120
- [user_pass] => $P$Bw1kVwpSlUpBh8ZJcfoacVICHuKPI5.
- [user_nicename] => antunakatt120
- [user_email] => blowown@nabobst.co.cc
- [user_url] =>
- [user_registered] => 2012-07-14 23:12:26
- [user_activation_key] =>
- [user_status] => 0
- [display_name] => AntunaKatt120
- )
- //-------------------------------------------------
- // current user object
- //-------------------------------------------------
- WP_User Object
- (
- [data] => stdClass Object
- (
- [ID] => 1
- [user_login] => dmkim1
- [user_pass] => $P$BycaOriW.ddAk797yLGr46jWErGaBy0
- [user_nicename] => dmkim1
- [user_email] => dmkim1979@gmail.com
- [user_url] =>
- [user_registered] => 2012-09-20 09:04:49
- [user_activation_key] =>
- [user_status] => 0
- [display_name] => dmkim1
- )
- [ID] => 1
- [caps] => Array
- (
- [administrator] => 1
- )
- [cap_key] => wp_capabilities
- [roles] => Array
- (
- [0] => administrator
- )
- [allcaps] => Array
- (
- [publish_posts] => 1
- [create_users] => 1
- [unfiltered_upload] => 1
- [administrator] => 1
- )
- [filter] =>
- )
- //-------------------------------------------------
- //-------------------------------------------------
- echo backslashit('test/').'<br/>';
- \t\e\s\t/
- echo htmlentities(balanceTags('<a href="#">inf', true)).'<br/>';
- <a href="#">inf</a>
- update_option('use_smilies', true);
- echo convert_smilies(" :)");
- echo 'esc_attr='.esc_attr('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'esc_html='.esc_html('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'esc_js='.esc_js('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'esc_textarea='.esc_textarea('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'esc_url='.esc_url('http://test.com/test?inf&test=zz')."\r\n";
- echo 'esc_url='.esc_url('test info & ')."\r\n";
- esc_attr=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- esc_html=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- esc_js=<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~
- esc_textarea=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- esc_url=http://test.com/test?inf&test=zz
- esc_url=http://testinfo&
- echo 'format_to_edit='.format_to_edit('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'format_to_post='.format_to_post('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'htmlentities2='.htmlentities2('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'sanitize_email='.sanitize_email('<a href="#">?test&\'z\'="test" http://test.com/test#@$%!~')."\r\n";
- echo 'sanitize_text_field='.sanitize_text_field('http://test.com/test?inf&test=zz')."\r\n";
- format_to_edit=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- format_to_post=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- htmlentities2=<a href="#">?test&'z'="test" http://test.com/test#@$%!~
- sanitize_email=
- sanitize_text_field=http://test.com/test?inf&test=zz
- //-------------------------------------------------
- //-------------------------------------------------
- wp_tag_cloud( $args );
- category_description( $category_id );
- tag_description( $tag = 0 )
- has_tag( $tag = '', $post = null )
- get_tag_link( $tag )
- get_next_posts_link( $label, $max_page );
- get_previous_posts_link( $label );
- wp_link_pages( $args );
- paginate_links( $args )
- next_image_link( $size, $text );
- previous_image_link( $size, $text );
- wp_get_recent_posts( $args, $output )
- wp_trim_excerpt( $text )
- author_can( $post, $capability );
- next_comments_link( $label, $max_page )
- get_archive_template();
- wp_get_theme( $stylesheet, $theme_root );
- get_month_link( $year, $month );
- date_i18n( $dateformatstring, $unixtimestamp, $gmt )
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement