我创建了一个自定义插件来显示主站点和微型站点(多站点)的最后一篇文章,并在页面上用短代码显示它。问题输出/内容显示在页脚后,而不是正文中。
密码
function tulisan_terbaru_function() { ?>
<h3>Tulisan terbaru website kebudayaan...</h3><?php date(\'j F Y\');
$blogs = get_last_updated();?>
<table class="widefat" cellspacing="0">
<?php
foreach ($blogs AS $blog) {
switch_to_blog($blog["blog_id"]);
$today = getdate();
$args = array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'date_query\' => array(
array(
\'year\' => $today[\'year\'],
\'month\' => $today[\'mon\'],
\'day\' => $today[\'mday\']
)
)
);
$wpb_all_query = new WP_Query($args); ?>
<?php if ( $wpb_all_query->have_posts() ) : ?>
<!-- the loop -->
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<tr> <td><?php the_time(\'H:i\');?></td><td><?php echo get_bloginfo(\'name\');?></td><td><a href="<?php the_permalink(); ?>"><?php the_title();?></a></td></tr>
<?php endwhile; ?>
<!-- end of the loop -->
<?php wp_reset_postdata(); ?>
<?php endif;
restore_current_blog();
};
};