In my template, in the functions file, a developer created a code to show the last posts of various blogs (wp mu) on the homepage. I would like to edit the code by showing the pages in place of the posts.
I'll show parts of the code where I think it is necessary to replace somewhere the word post with page.
Can you help me to find out where and how? Thanks!
add_shortcode( 'newswpmu', 'newswpmu_func' );
function newswpmu_func( $atts, $content = null ) { // New function parameter $content is added!
global $post;
extract( shortcode_atts( array(
'title' => 'blog title',
'blogid' => 1,
'format' => 3,
'show' => 3,
'sortby' => "lastest",
'exlength' => 100,
'meta' => "",
'readmore' => 'disabled',
'seeall' => 'enabled',
'seeall_link' => '',
'seeall_text' => 'see all',
'classes' => '',
'format_medium' => 2,
), $atts ) );
$content = wpb_js_remove_wpautop($content, true); // fix unclosed/unwanted paragraph tags in $content
//print_r($post);
(...)
// show list articles
wp_reset_query();
switch_to_blog($blogid);
$my_query = new WP_Query('showposts='.$show.'&orderby= ' . $orderby . '&order=' . $order);
$articlecount = 0;
$articlecontent = "";
$get_meta_content = "";
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
$articlecount ++;
$thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full');
$image_url_small = str_replace(".jpg", "-350x175.jpg", $thumb_url[0]);
$image_url_big = str_replace(".jpg", "-600x300.jpg", $thumb_url[0]);
(...)
$articlecontent .= '
<article class="post-item post-' . get_the_ID() . ' post type-post status-publish format-standard has-post-thumbnail" itemscope="" itemtype="http://schema.org/Article">
<meta itemprop="datePublished" content="' . get_the_date(get_option('date_format')) . '">
<div class="gp-post-thumbnail featured-content image-above">
<a href="' . get_the_permalink() . '" title="' . get_the_title() . '">
<img src="' . $image_url_small . '" data-rel="' . $image_url_big . '" alt="' . get_the_title() . '" class="wp-post-image" itemprop="image" height="150" width="300">
</a>
</div>
<div class="post-item-content image-above">
&post_type=page
to the end of yournew WP_Query()
and see if it helps.