當前位置: 首頁>>代碼示例>>PHP>>正文


PHP start_wp函數代碼示例

本文整理匯總了PHP中start_wp函數的典型用法代碼示例。如果您正苦於以下問題:PHP start_wp函數的具體用法?PHP start_wp怎麽用?PHP start_wp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了start_wp函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: widget_subpagehierarchy_page_rows

 function widget_subpagehierarchy_page_rows($headpage, $parent = 0, $level = 0, $pages = 0)
 {
     global $wpdb, $class, $post;
     if (!$pages) {
         $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
     }
     if ($pages) {
         foreach ($pages as $post) {
             start_wp();
             if ($post->post_parent == $parent) {
                 $post->post_title = wp_specialchars($post->post_title);
                 $pad = str_repeat('—', $level);
                 $id = $post->ID;
                 if ($id == $headpage) {
                     $selectString = ' selected';
                 } else {
                     unset($selectString);
                 }
                 $class = 'alternate' == $class ? '' : 'alternate';
                 echo '  <option value="' . $post->ID . '"' . $selectString . ">{$pad}" . $post->post_title . "</option>\n";
                 widget_subpagehierarchy_page_rows($headpage, $id, $level + 1, $pages);
             }
         }
     } else {
         return false;
     }
 }
開發者ID:64kbytes,項目名稱:stayinba,代碼行數:27,代碼來源:ldpagehierarchy.php

示例2: b_wp_contents_show

function b_wp_contents_show($options)
{
    //	global $xoopsDB,$xoopsUser;
    //	global $tableoptions,$tableusers;
    //	global $id, $posts, $post, $day, $previousday, $newday;
    $id = 1;
    global $posts, $post, $day, $previousday, $newday;
    global $dateformat, $time_difference, $siteurl, $blogfilename;
    global $tablelinks, $tablelinkcategories;
    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
    global $tableposts, $tablepost2cat, $tablecomments, $tablecategories;
    global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace;
    global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    $blog = 1;
    $block = array();
    $block['siteurl'] = $siteurl;
    foreach ($posts as $post) {
        $content = array();
        start_wp();
        $content['date'] = the_date('', '<h2>', '</h2>', false);
        $content['time'] = the_time('', false);
        $content['title'] = the_title('', '', false);
        $content['permlink'] = get_permalink();
        //
        ob_start();
        the_author();
        $content['author'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_category();
        $content['category'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_content();
        $content['body'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        link_pages('<br />Pages: ', '<br />', 'number');
        $content['linkpage'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)');
        $content['comments'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        trackback_rdf();
        $content['trackback'] = ob_get_contents();
        ob_end_clean();
        //
        $block['contents'][] = $content;
    }
    return $block;
}
開發者ID:BackupTheBerlios,項目名稱:nobunobuxoops-svn,代碼行數:59,代碼來源:wp_contents.php

示例3: b_wp_contents_show

function b_wp_contents_show($options)
{
    global $xoopsDB, $xoopsUser, $wpdb, $siteurl;
    global $tableoptions, $tableposts, $tableusers, $tablecategories, $tablecomments, $tablepost2cat;
    global $querystring_start, $querystring_equal, $querystring_separator;
    global $id, $posts, $post, $day, $previousday, $dateformat, $newday;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    $blog = 1;
    $block = array();
    $block['siteurl'] = $siteurl;
    foreach ($posts as $post) {
        $content = array();
        start_wp();
        $content['date'] = the_date('', '<h2>', '</h2>', false);
        $content['time'] = the_time('', false);
        $content['title'] = the_title('', '', false);
        $content['permlink'] = get_permalink();
        //
        ob_start();
        the_author();
        $content['author'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_category();
        $content['category'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_content();
        $content['body'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        link_pages('<br />Pages: ', '<br />', 'number');
        $content['linkpage'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)');
        $content['comments'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        trackback_rdf();
        $content['trackback'] = ob_get_contents();
        ob_end_clean();
        //
        $block['contents'][] = $content;
    }
    return $block;
}
開發者ID:BackupTheBerlios,項目名稱:nobunobuxoops-svn,代碼行數:52,代碼來源:wp_contents.php

示例4: page_rows

function page_rows($parent = 0, $level = 0, $pages = 0)
{
    global $wpdb, $class, $post;
    if (!$pages) {
        $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
    }
    if ($pages) {
        foreach ($pages as $post) {
            start_wp();
            if ($post->post_parent == $parent) {
                $post->post_title = wp_specialchars($post->post_title);
                $pad = str_repeat('&#8212; ', $level);
                $id = $post->ID;
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
  <tr id='page-<?php 
                echo $id;
                ?>
' class='<?php 
                echo $class;
                ?>
'> 
    <th scope="row"><?php 
                echo $post->ID;
                ?>
</th> 
    <td>
      <?php 
                echo $pad;
                the_title();
                ?>
 
    </td> 
    <td><?php 
                the_author();
                ?>
</td>
    <td><?php 
                echo mysql2date('Y-m-d g:i a', $post->post_modified);
                ?>
</td> 
	<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="edit"><?php 
                _e('View');
                ?>
</a></td>
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='post.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td> 
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$id}", 'delete-post_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title())) . "' );\">" . __('Delete') . "</a>";
                }
                ?>
</td> 
  </tr> 

<?php 
                page_rows($id, $level + 1, $pages);
            }
        }
    } else {
        return false;
    }
}
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:70,代碼來源:admin-functions.php

示例5: get_a_post

function get_a_post($id = 'GETPOST')
{
    global $post, $tableposts, $tablepostmeta, $wp_version, $wpdb;
    if ($wp_version < 1.5) {
        $table = $tableposts;
    } else {
        $table = $wpdb->posts;
    }
    $now = current_time('mysql');
    $name_or_id = '';
    $orderby = 'post_date';
    if (!$id || 'GETPOST' == $id || 'GETRANDOM' == $id) {
        if ($wp_version < 2.1) {
            $query_suffix = "post_status = 'publish'";
        } else {
            $query_suffix = "post_type = 'post' AND post_status = 'publish'";
        }
    } elseif ('GETPAGE' == $id) {
        if ($wp_version < 2.1) {
            $query_suffix = "post_status = 'static'";
        } else {
            $query_suffix = "post_type = 'page' AND post_status = 'publish'";
        }
    } elseif ('GETSTICKY' == $id) {
        if ($wp_version < 1.5) {
            $table .= ', ' . $tablepostmeta;
        } else {
            $table .= ', ' . $wpdb->postmeta;
        }
        $query_suffix = "ID = post_id AND meta_key = 'sticky' AND meta_value = 1";
    } else {
        $query_suffix = "(post_status = 'publish' OR post_status = 'static')";
        if (is_numeric($id)) {
            $name_or_id = "ID = '{$id}' AND";
        } else {
            $name_or_id = "post_name = '{$id}' AND";
        }
    }
    if ('GETRANDOM' == $id) {
        $orderby = 'RAND()';
    }
    $post = $wpdb->get_row("SELECT * FROM {$table} WHERE {$name_or_id} post_date <= '{$now}' AND {$query_suffix} ORDER BY {$orderby} DESC LIMIT 1");
    get_post_custom($post->ID);
    if ($wp_version < 1.5) {
        start_wp();
    } else {
        setup_postdata($post);
    }
}
開發者ID:wangshijun101,項目名稱:morketing.cn,代碼行數:49,代碼來源:content-gallery.php

示例6: b_wp_contents_show

 function b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     global $wpdb, $siteurl, $post, $use_cache, $category_cache, $comment_count_cache;
     global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace, $authordata;
     global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni, $wp_filter;
     global $wp_id, $wp_mod, $wp_base, $wp_inblock, $xoopsConfig, $previousday, $time_difference, $day;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 2;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     global $dateformat, $timeformat;
     $dateformat = stripslashes(get_settings('date_format'));
     $timeformat = stripslashes(get_settings('time_format'));
     $now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600);
     $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} ";
     $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) ";
     $request .= "WHERE post_status = 'publish' ";
     $request .= " AND post_date <= '" . $now . "'";
     $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}";
     $lposts = $wpdb->get_results($request);
     if ($lposts) {
         // Get the categories for all the posts
         foreach ($lposts as $post) {
             $post_id_list[] = $post->ID;
             $category_cache[$wp_id][$post->ID] = array();
         }
         $post_id_list = implode(',', $post_id_list);
         $dogs = $wpdb->get_results("SELECT DISTINCT\n\t\t\t\tID, category_id, cat_name, category_nicename, category_description, category_parent\n\t\t\t\tFROM {$wpdb->categories[$wp_id]}, {$wpdb->post2cat[$wp_id]}, {$wpdb->posts[$wp_id]}\n\t\t\t\tWHERE category_id = cat_ID AND post_id = ID AND post_id IN ({$post_id_list})");
         foreach ($dogs as $catt) {
             $category_cache[$wp_id][$catt->ID][] = $catt;
         }
         // Do the same for comment numbers
         $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount\n\t\t\t\tFROM {$wpdb->posts[$wp_id]}\n\t\t\t\tLEFT JOIN {$wpdb->comments[$wp_id]} ON ( comment_post_ID = ID  AND comment_approved =  '1')\n\t\t\t\tWHERE post_status =  'publish' AND ID IN ({$post_id_list})\n\t\t\t\tGROUP BY ID");
         foreach ($comment_counts as $comment_count) {
             $comment_count_cache[$wp_id]["{$comment_count->ID}"] = $comment_count->ccount;
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template');
     $block['style'] = block_style_get($wp_num, false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $previousday = 0;
     foreach ($lposts as $post) {
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($dateformat, '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             //
             ob_start();
             the_author_posts_link();
             $content['author'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_category();
             $content['category'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_content();
             $content['body'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             link_pages('<br />Pages: ', '<br />', 'number');
             $content['linkpage'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) {
                 comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             } else {
                 xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
                 echo " | ";
                 comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS);
             }
             //				comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             $content['comments'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             trackback_rdf();
             $content['trackback'] = ob_get_contents();
             ob_end_clean();
             //
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:nobunobuxoops-svn,代碼行數:101,代碼來源:wp_contents.php

示例7: show_report_extended

    function show_report_extended($type = 'popular', $limit = 50)
    {
        global $wpdb, $post;
        $columns = array('popularity' => __('', 'alexking.org'), 'title' => __('Title'), 'categories' => __('Categories'), 'single_views' => __('Post', 'alexking.org'), 'category_views' => __('Cat', 'alexking.org'), 'archive_views' => __('Arch', 'alexking.org'), 'home_views' => __('Home', 'alexking.org'), 'feed_views' => __('Feed', 'alexking.org'), 'comments' => __('Com'), 'pingbacks' => __('Ping'), 'trackbacks' => __('Track'));
        ?>
<div id="akpc_most_popular">
	<table width="100%" cellpadding="3" cellspacing="2"> 
		<tr>
<?php 
        foreach ($columns as $column_display_name) {
            ?>
			<th scope="col"><?php 
            echo $column_display_name;
            ?>
</th>
<?php 
        }
        ?>
			</tr>
<?php 
        $posts = $wpdb->get_results("\n\t\t\tSELECT p.*, pop.*\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tLEFT JOIN {$wpdb->ak_popularity} pop\n\t\t\tON p.ID = pop.post_id\n\t\t\tWHERE p.post_status = 'publish'\n\t\t\tORDER BY pop.total DESC\n\t\t\tLIMIT " . intval($limit));
        if ($posts) {
            $bgcolor = '';
            foreach ($posts as $post) {
                start_wp();
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
 
		<tr class='<?php 
                echo $class;
                ?>
'>
<?php 
                foreach ($columns as $column_name => $column_display_name) {
                    switch ($column_name) {
                        case 'popularity':
                            ?>
				<td><?php 
                            $this->show_post_rank(-1, $post->total);
                            ?>
</td>
<?php 
                            break;
                        case 'title':
                            ?>
				<td><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></td>
<?php 
                            break;
                        case 'categories':
                            ?>
				<td><?php 
                            the_category(',');
                            ?>
</td>
<?php 
                            break;
                        case 'single_views':
                            ?>
				<td class="right"><?php 
                            print $post->single_views;
                            ?>
</td>
<?php 
                            break;
                        case 'category_views':
                            ?>
				<td class="right"><?php 
                            print $post->category_views;
                            ?>
</td>
<?php 
                            break;
                        case 'archive_views':
                            ?>
				<td class="right"><?php 
                            print $post->archive_views;
                            ?>
</td>
<?php 
                            break;
                        case 'home_views':
                            ?>
				<td class="right"><?php 
                            print $post->home_views;
                            ?>
</td>
<?php 
                            break;
                        case 'feed_views':
                            ?>
				<td class="right"><?php 
                            print $post->feed_views;
                            ?>
</td>
//.........這裏部分代碼省略.........
開發者ID:standsito,項目名稱:cosas2,代碼行數:101,代碼來源:popularity-contest.php

示例8: header

}

header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
$more = 1;

?>
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php echo $wp_version ?>" -->
<rss version="0.92">
<channel>
	<title><?php bloginfo_rss('name') ?></title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss('description') ?></description>
	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language><?php echo get_option('rss_language'); ?></language>

<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
	<item>
		<title><?php the_title_rss() ?></title>
<?php if (get_settings('rss_use_excerpt')) { ?>
		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php } else { // use content ?>
		<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length')) ?></description>
<?php } ?>
		<link><?php permalink_single_rss() ?></link>
	</item>
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
</channel>
</rss>
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:30,代碼來源:wp-rss.php

示例9: query_posts

			
				<div class="column medium-3 front-info">
					<div class="row collapse">
						<div id="latest-post" class="column small-12">
							<i class="fa fa-newspaper-o"></i>
							<a href="http://visiblesandbox.com/grainne/blog/"><h3>LATEST NEWS</h3></a>
							
						
								
								<?php 
query_posts('showposts=3');
?>
								<?php 
$posts = get_posts('category_name=news&numberposts=3&offset=0');
foreach ($posts as $post) {
    start_wp();
    ?>
								
								<div class="news-summary-item row collapse">
									<div class="column medium-3">
											<?php 
    if (has_post_thumbnail()) {
        the_post_thumbnail(array(29, 29));
    } else {
        ?>
											
											
											
											<?php 
    }
    ?>
開發者ID:visiblefrank,項目名稱:Grainne-Repo,代碼行數:30,代碼來源:page-home.php

示例10: export_wp


//.........這裏部分代碼省略.........

print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";

?>

<!--
	This is a WordPress eXtended RSS file generated by WordPress as an export of 
	your blog. It contains information about your blog's posts, comments, and 
	categories. You may use this file to transfer that content from one site to 
	another. This file is not intended to serve as a complete backup of your 
	blog.
	
	To import this information into a WordPress blog follow these steps:
	
	1.	Log into that blog as an administrator.
	2.	Go to Manage > Import in the blog's admin.
	3.	Choose "WordPress" from the list of importers.
	4.	Upload this file using the form provided on that page.
	5.	You will first be asked to map the authors in this export file to users 
		on the blog. For each author, you may choose to map an existing user on 
		the blog or to create a new user.
	6.	WordPress will then import each of the posts, comments, and categories 
		contained in this file onto your blog.
-->

<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.0/"
>

<channel>
	<title><?php bloginfo_rss('name'); ?></title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss("description") ?></description>
	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
	<language><?php echo get_option('rss_language'); ?></language>
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
	<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
<?php endforeach; endif; ?>
	<?php do_action('rss2_head'); ?>
	<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<item>
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?>

<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
<wp:status><?php echo $post->post_status; ?></wp:status>
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<?php
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
if ( $postmeta ) {
?>
<?php foreach( $postmeta as $meta ) { ?>
<wp:postmeta>
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
</wp:postmeta>
<?php } ?>
<?php } ?>
<?php
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
</wp:comment>
<?php } } ?>
	</item>
<?php } } ?>
</channel>
</rss>
<?php
	die();
}
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:101,代碼來源:export.php

示例11: _b_wp_contents_show


//.........這裏部分代碼省略.........
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_post_id_criteria =& new Criteria('comment_post_ID', '(' . $_post_id_list . ')', 'IN');
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
         // Get post-meta info
         if ($meta_list = $GLOBALS['wpdb']->get_results('SELECT post_id, meta_key, meta_value FROM ' . wp_table('postmeta') . ' WHERE post_id IN(' . $_post_id_list . ') ORDER BY post_id, meta_key', ARRAY_A)) {
             // Change from flat structure to hierarchical:
             $GLOBALS['post_meta_cache'][wp_id()] = array();
             foreach ($meta_list as $metarow) {
                 $mpid = $metarow['post_id'];
                 $mkey = $metarow['meta_key'];
                 $mval = $metarow['meta_value'];
                 // Force subkeys to be array type:
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid] = array();
                 }
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"] = array();
                 }
                 // Add a value to the current pid/key:
                 $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"][] = $mval;
             }
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS, '', 'Trackback Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     if (!$_wpTpl->tpl_exists($tpl_file)) {
         $tpl_file = 'wp_contents.html';
     }
     $block['content'] = $_wpTpl->fetch($tpl_file);
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
開發者ID:nobunobuta,項目名稱:xoops_mod_WordPress,代碼行數:101,代碼來源:wp_contents.php

示例12: _b_wp_contents_show

 function _b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     $GLOBALS['dateformat'] = stripslashes(get_settings('date_format'));
     $GLOBALS['timeformat'] = stripslashes(get_settings('time_format'));
     $_criteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
     $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
     $_criteria->setGroupBy(wp_table('posts') . '.ID');
     $_criteria->setSort('post_date');
     $_criteria->setOrder('DESC');
     $_criteria->setLimit($no_posts);
     $_criteria->setStart(0);
     $postHandler =& wp_handler('Post');
     $postObjects =& $postHandler->getObjects($_criteria, false, '', 'DISTINCT');
     $lposts = array();
     foreach ($postObjects as $postObject) {
         $lposts[] =& $postObject->exportWpObject();
     }
     if ($lposts) {
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
開發者ID:BackupTheBerlios,項目名稱:nobunobuxoops-svn,代碼行數:93,代碼來源:wp_contents.php

示例13: export_wp

        function export_wp($cats)
        {
            global $wpdb, $posts, $post;
            $filename = 'wordpress.' . date('Y-m-d') . '.xml';
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header("Content-Disposition: attachment; filename={$filename}");
            header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
            $posts = query_posts('');
            $cats = implode(',', $cats);
            $postswithcats = $wpdb->get_col("SELECT DISTINCT(post_id) FROM " . $wpdb->post2cat . " WHERE category_id IN ({$cats})");
            $postcats = implode(',', $postswithcats);
            $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID IN ({$postcats}) ORDER BY post_date_gmt ASC");
            ?>
<!-- generator="wordpress/<?php 
            bloginfo_rss('version');
            ?>
" created="<?php 
            echo date('Y-m-d H:m');
            ?>
"-->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.0/"
>

<channel>
	<title><?php 
            bloginfo_rss('name');
            ?>
</title>
	<link><?php 
            bloginfo_rss('url');
            ?>
</link>
	<description><?php 
            bloginfo_rss("description");
            ?>
</description>
	<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
            ?>
</pubDate>
	<generator>http://wordpress.org/?v=<?php 
            bloginfo_rss('version');
            ?>
</generator>
	<language><?php 
            echo get_option('rss_language');
            ?>
</language>
	<?php 
            do_action('rss2_head');
            if ($posts) {
                foreach ($posts as $post) {
                    start_wp();
                    ?>
<item>
<title><?php 
                    the_title_rss();
                    ?>
</title>
<link><?php 
                    permalink_single_rss();
                    ?>
</link>
<pubDate><?php 
                    echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
                    ?>
</pubDate>
<dc:creator><?php 
                    the_author();
                    ?>
</dc:creator>
<?php 
                    the_category_rss();
                    ?>

<guid isPermaLink="false"><?php 
                    the_guid();
                    ?>
</guid>
<description></description>
<wp:excerpt><![CDATA[<?php 
                    echo $post->post_excerpt;
                    ?>
]]></wp:excerpt>
<content:encoded><![CDATA[<?php 
                    echo $post->post_content;
                    ?>
]]></content:encoded>
<wp:post_date><?php 
                    echo $post->post_date;
                    ?>
</wp:post_date>
<wp:post_date_gmt><?php 
                    echo $post->post_date_gmt;
                    ?>
//.........這裏部分代碼省略.........
開發者ID:prabhu,項目名稱:desistartups,代碼行數:101,代碼來源:wp-xmlmigrate.php

示例14: if

  <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Widgets')) : ?>
  
  
  
  <div class="three"><h4>Theme Features</h4>
  <div class="textwidget"><p>Welcome to the Layers Theme which was designed for the artist in mind. Whether you are an illustrator, graphic designer, a Photographer, or other, you will find this theme is best suited to showcase your artistic abilities. Use it as a blog or even a portfolio...the clean style and clean edges will help put more focus on your creativity.</p>
  <ul>
  <li>Theme Settings for personalization</li>
  <li>Almost unlimited colour variations</li>
  <li>4 Showcase options</li>
  <li>Custom Google Fonts</li>
  <li>...and more!</li>
  </ul></div>
		</div><div class="three"><h4>Showcase Options</h4><div class="textwidget"><p>Layers comes with 4 Showcase options to give you choices without using plugins.</p>
		<img src="<?php bloginfo('template_directory'); ?>/images/smScreenshot.jpg" class="aligncenter"></div>

		</div><div class="three"><h4><?php _e( 'Recent Posts', 'pts' ); ?></h4>			<div class="textwidget"><p>Check out the recent articles posted here with the Layers Theme and keep up to date with the latest news along with great photographic imagery that shows the great things in nature. </p>
		
<ul>
<?php query_posts('category_id=1&showposts=5');?>
<?php $posts = get_posts('category=#&numberposts=#&offset=0');
	foreach ($posts as $post) : start_wp(); ?>
<li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?></ul></div>
		</div><div class="clearfix"></div>
		
		
		
  <?php endif; ?>
  <div  class="clearfix"></div></div>
</div>
開發者ID:roryzweistra,項目名稱:Shapshap,代碼行數:31,代碼來源:bottomwidgets.php

示例15: podPress_xspf_playlist

function podPress_xspf_playlist()
{
    global $podPress, $more, $posts, $post, $m;
    header('HTTP/1.0 200 OK');
    header('Content-type: application/xspf+xml; charset=' . get_bloginfo('charset'), true);
    header('Content-Disposition: attachment; filename="playlist.xspf"');
    header('Cache-Control: no-cache, must-revalidate');
    // HTTP/1.1
    header('Expires: Wed, 28 Oct 2010 05:00:00 GMT');
    // Date in the past
    $more = 1;
    echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '" ?' . ">\n";
    echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">' . "\n";
    echo "\t" . '<title>' . podPress_feedSafeContent(get_bloginfo('blogname')) . '</title>' . "\n";
    echo "\t" . '<annotation><![CDATA[' . $podPress->settings['iTunes']['summary'] . ']]></annotation>' . "\n";
    if (empty($podPress->settings['iTunes']['author'])) {
        $creator = get_bloginfo('blogname');
    } else {
        $creator = $podPress->settings['iTunes']['author'];
    }
    echo "\t" . '<creator>' . podPress_feedSafeContent($creator) . '</creator>' . "\n";
    echo "\t" . '<location>' . get_feed_link('playlist.xspf') . '</location>' . "\n";
    if (!empty($podPress->settings['rss_license_url'])) {
        echo "\t" . '<license>' . $podPress->settings['rss_license_url'] . '</license>' . "\n";
    }
    echo "\t" . '<trackList>' . "\n";
    if (isset($posts)) {
        foreach ($posts as $post) {
            start_wp();
            /* This is a call to a very very old function and it seems to be not necessary if $post is global. */
            $enclosureTag = podPress_getEnclosureTags('xspf');
            if ($enclosureTag != '') {
                // if no enclosure tag, no need for track tags
                $is_password_protected = podpress_post_is_password_protected();
                if (FALSE === $is_password_protected) {
                    echo $enclosureTag;
                }
            }
        }
    }
    echo "\t" . '</trackList>' . "\n";
    echo '</playlist>' . "\n";
    exit;
}
開發者ID:niko-lgdcom,項目名稱:archives,代碼行數:44,代碼來源:podpress_feed_functions.php


注:本文中的start_wp函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。