Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
- echo '<h3>list of blog post types</h3>';
- $post_types = get_post_types (array(),'names');
- echo implode(',',$post_types);
- echo '<h2>list of blog taxonomies</h2>';
- $taxz = get_taxonomies(array(), 'objects');
- foreach ($taxz as $tax) {
- echo '<h3>'.$tax->name.'</h3>';
- $terms = get_terms($tax->name, array('hide_empty'=>false,'parent'=>0));
- echo '<ul>';
- foreach ($terms as $term) {
- echo $term->term_id.'<br/>';
- echo '<li><a href="'.get_term_link((integer)$term->term_id, $tax->name).
- '" target="_blank">'.
- $term->name.' ('.$term->count.')</a></li>';
- $subterms = get_term_children($term->term_id, $tax->name);
- echo '<ol>';
- foreach ($subterms as $id) {
- $subterm = get_term($id, $tax->name);
- echo '<li>'.$subterm->term_id.' <a href="'.
- get_term_link((integer)$subterm->term_id, $tax->name).
- '" target="_blank">'.$subterm->name.'</a> ('.$subterm->count.')</li>';
- }
- echo '</ol>';
- }
- echo '</ul>';
- }
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
- <?php
- //-------------------------------------------------
- define('WP_USE_THEMES', false);
- require('../wp-load.php');
- header('Content-type: text/html; charset=utf-8');
- //-------------------------------------------------
- @ini_set('display_errors',true);
- //---------------------------------
- $cats = get_categories(array('parent'=>get_cat_id('Блог')));
- foreach ($cats as $cat) {
- echo '<h3>'.$cat->name.' ('.get_category_parents($cat->term_id).')</h3>';
- echo '<a href="'.get_term_link((integer)$cat->term_id,'category').'">go to</a><br/>';
- $posts = get_posts(array('category'=>$cat->term_id));
- echo '<ul>';
- foreach ($posts as $post) {
- setup_postdata($post);
- echo '<li>'.get_post_status(get_the_id());
- if (has_post_thumbnail(get_the_id())) {
- echo get_the_post_thumbnail(get_the_id(),'thumbnail');
- }
- echo '<a href="'.get_permalink().'" target="_blank">'.
- get_the_title().'</a> ';
- $author = $post->post_author;
- $author4 = get_user_by('id', $author);
- $author_url = get_author_posts_url($author);
- echo '<a href="'.$author_url.'" target="_blank">'.$author4->display_name.
- '</a> '.get_the_date('d.m.Y H:i:s',get_the_id());
- echo '<br/>comments<br/>';
- comments_popup_link( 'No comments yet', '1 comment', '% comments',
- 'comments-link', 'Comments are off for this post');
- if ($post->comment_count>0) {
- $comments = get_comments (array('post_id'=>get_the_id(), 'number'=>4));
- echo '<ol>';
- foreach ($comments as $comment) {
- echo '<li>';
- echo get_avatar($comm, 32).' ';
- echo '<a href="'.get_author_posts_url($comment->user_id).'" target="_blank">';
- echo $comment->comment_author.'</a> '.$comment->comment_content.
- ' '.$comment->comment_date;
- echo '</li>';
- }
- echo '</ol>';
- }
- echo '<br/>attachments<br/>';
- $atts = & get_children (array('post_type'=>'attachment','post_parent'=>get_the_id()));
- echo '<ol>';
- foreach ($atts as $att) {
- if (wp_attachment_is_image($att->ID)) {
- $src = wp_get_attachment_image_src($att->ID,'large');
- echo '<li>'.$att->post_title.' '.$att->post_mime_type.
- '<a href="'.$src[0].'" target="_blank">'.
- wp_get_attachment_image($att->ID, 'thumbnail').'</a></li>';
- }
- }
- echo '</ol>';
- 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 '<br/>edit block<br/>';
- echo get_edit_post_link(get_the_id());
- echo get_delete_post_link(get_the_id());
- echo '</li>';
- }
- echo '</ul>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement