'.wp_trim_words( strip_tags( strip_shortcodes( $content ) ) , (int) $ampforwp_excerpt_length ).$read_more_link.'
'; } $loopdate = ""; $loopdate = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') ) .' '. ampforwp_translation( ampforwp_get_setting('amp-translator-ago-date-text'), 'ago'); $loopdate = apply_filters('ampforwp_modify_post_date',$loopdate); $loopdate = ''.esc_html($loopdate).'
'; $title = get_the_title(); $postid = get_the_ID(); $author = get_the_author(); $tags = get_the_tags(); if(is_array($tags) && count($tags) > 0){ $tags = $tags[0]->name; } // get_the_author_meta( string $field = '', int $user_id = false ); $postdate = get_the_date( ' F j, Y', $postid ); $rawhtml = str_replace(array( "{{ampforwp_post_url}}", "{{image}}", "{{width}}", "{{height}}", "{{title}}", "{{excerptContent}}", "{{readMore}}", "{{loopdate}}", "{{authorname}}", "{{postdate}}", "{{image_alt}}", "{{tags}}" ), array( $ampforwp_post_url, $image, $width, $height, $title, $excerptContent, $readMore, $loopdate, $author, $postdate, $image_alt, $tags, ), $loopHtml); $rawhtml = ampforwp_replaceIfContentConditional("ampforwp_post_url", $ampforwp_post_url, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("image", $image, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("width", $width, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("height", $height, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("title", $title, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("excerptContent", $excerptContent, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("readMore", $readMore, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("loopdate", $loopdate, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("authorname", $author, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("postdate", $postdate, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("image_alt", $image_alt, $rawhtml); $rawhtml = ampforwp_replaceIfContentConditional("tags", $tags, $rawhtml); $rawhtml = apply_filters( 'ampforwp_pb_cntmod_rawhtml', $rawhtml ); $contenthtml .= $rawhtml; } } /* Restore original Post Data */ wp_reset_postdata(); $pagination_links = ampforwp_cat_pagination_links($the_query,$fieldValues); //echo $contenthtml; //die; return array('contents'=>$contenthtml,'pagination_links' => $pagination_links); } function ampforwp_cat_pagination_links($the_query,$fieldValues){ $pagination_links = ''; $pagination_text = 'pageno'; if( ampforwp_is_front_page()){ $queryUrl = esc_url( ampforwp_url_controller(home_url()) ); }else{ $queryUrl = esc_url(ampforwp_url_controller(get_permalink(ampforwp_get_the_ID()))); } if( isset($fieldValues['pagination']) && $fieldValues['pagination'] == 1){ /*Pagination Sart*/ $offset = $fieldValues['posts_offset']; $per_page = $the_query->query['posts_per_page']; $offset_num = ceil($offset/$per_page); if( $the_query->max_num_pages == $offset_num ){ $total_num_pages = $the_query->max_num_pages; }else{ $total_num_pages = $the_query->max_num_pages - $offset_num; } if(isset($_GET[$pagination_text]) && $_GET[$pagination_text]!='' ){ $paged = intval($_GET[$pagination_text]); }else{ $paged = 1; } $pagination_links .= '