shortcode atts pagination

I’m trying to have the shortcode_atts published to me on several pages but I cant do it, any suggestions?

public function upme_favorite_posts_list($atts){
global $post,$wpdb,$upme_options;

extract( shortcode_atts( array(
‘number_of_posts’ => 100,
‘featured_image’ => ‘no’,
‘user_id’ => ‘no’,
‘order’ => ‘asc’,
‘orderby’ => ‘meta_value’,
‘posts_per_page’=> 5,
‘meta_key’ => ‘fecha_’,

), $atts ) );

$content = ”;

if($user_id != ‘no’){
$user_id = (int) $user_id;
if( $user_id == ‘0’ ){
if(is_user_logged_in()){
$user_id = get_current_user_id();

$sql = $wpdb->prepare( “SELECT upf.*,p.post_excerpt,p.guid FROM {$wpdb->prefix}upme_post_features as upf inner join $wpdb->posts as p on p.ID = upf.post_id WHERE upf.favorite_status = %d AND upf.user_id = %d”, 1 , $user_id );
}else{
return;
}
}else{
$sql = $wpdb->prepare( “SELECT upf.*,p.post_excerpt,p.guid FROM {$wpdb->prefix}upme_post_features as upf inner join $wpdb->posts as p on p.ID = upf.post_id WHERE upf.favorite_status = %d AND upf.user_id = %d”, 1 , $user_id );
}

$result = $wpdb->get_results($sql);
if($result){

$featured_enabled_types = (array) $upme_options->upme_settings[‘featured_image_enabled_types’];
$featured_image_setting_status = in_array(‘favorite’,$featured_enabled_types);
$featured_image_status = ($featured_image == ‘no’ || $featured_image_setting_status);

$content .= ‘<div class=”upme-main upme-main-“>’;
foreach($result as $row){

if($featured_image_status){

$image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id($row->post_id), ‘thumbnail’);
$image_src = upme_url . ‘img/default-post-thumbnail.png’;
if($upme_options->upme_settings[‘favorite_default_featured_image’] != ”){
$image_src = $upme_options->upme_settings[‘favorite_default_featured_image’];
}
if (is_array($image_attributes) && (” != $image_attributes[0])) {
$image_src = $image_attributes[0];
}

$content .= ‘<div class=”upme-field upme-custom-post-list-field”>
<div class=”upme-post-feature-image”>
<img src=”‘.$image_src.'”>
</div>
<div class=”upme-post-feature-value”>
<span>
<a target=”iframe1″ href=”‘.$row->guid.'”>’.$row->post_excerpt.'</a>
</span>
</div>
</div>’;

}else{
$content .= ‘<div class=”upme-field upme-custom-post-list-field”>
<div class=”upme-post-field-type”></div>
<div class=”upme-post-field-value”>
<span>
<a target=”iframe1″ href=”‘.$row->guid.'”>’.$row->post_excerpt.'</a>
</span>
</div>
</div>’;
}

}
$content .= ‘</div><div class=”upme-clear”></div>’;
}
// echo “<pre>”;print_r($result);exit;
}

return $content;
}

Read more here:: shortcode atts pagination

Leave a Reply

Your email address will not be published. Required fields are marked *