2017.8.09 wordpress 在其他网站调用另一个网站的分类文章
 
                            在自己的网站件一个PHP页面,这里创建的是call.php
然后在头部加入这段代码
<?php
define('WP_USE_THEMES', false);
require( './wp-load.php' );
?>然后再在下面直接写入要调取的东西即可,按照正常做页面的方法写就可以
如
 <ul>
        <?php $posts = query_posts($query_string . '&post_type=cart&orderby=date&showposts=5'); ?>
        <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
        <li>
            <div class="jobs-date">
                <?php the_modified_date('Y-m-d'); ?>
            </div>
            <div class="notice_content">
                <div class="job-thumbnail"><a href="<?php the_permalink(); ?>"><img src="<?php
		$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium');
		if(!empty($large_image_url)){echo $large_image_url[0];}
		else{
			echo get_template_directory_uri().'/images/watermark.png';
		} ?>" alt="<?php bloginfo('name'); ?>"/></a></div>
                <div class="jobs_info_excerpt">
                    <div class="jobs-info">
                        <a href="<?php the_permalink(); ?>">
                            <h3>
                                <?php the_title(); ?>
                            </h3>
                        </a>
                        <div class="the_excerpt">
                            <?php the_excerpt();?>
                        </div>
                    </div>
                </div>
            </div>
        </li>
        <?php endwhile; ?>
        <?php endif; ?>
    </ul>然后在想调取这些内容的页面填入代码
<?php    
    $data =  file_get_contents('可以找到的网址/call.php');
    echo $data;    
    ?>
就可以了
自己记得写写样式
相关文章
        
    