# Integrate the pull to refresh feature in Ionic 3 with Wordpress

**URL:** <https://forum.ionicframework.com/t/integrate-the-pull-to-refresh-feature-in-ionic-3-with-wordpress/131077>\
**Category:** ionic-v3\
**Created:** [May 22, 2018, 3:13pm UTC](https://forum.ionicframework.com/t/integrate-the-pull-to-refresh-feature-in-ionic-3-with-wordpress/131077 "2018-05-22T15:13:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JEricaM](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JEricaM](https://forum.ionicframework.com/u/JEricaM)\
**Post date:** [May 22, 2018, 3:13pm UTC](https://forum.ionicframework.com/t/integrate-the-pull-to-refresh-feature-in-ionic-3-with-wordpress/131077/1 "2018-05-22T15:13:07Z")

</div>

I’m working on a Ionic3 app integrated with Wordpress using REST API v2 and I need to include the **pull to refresh** feature but I don’t understand how to do it with my code.

This is my function that retrieves my post

```
getPostsWordpress(){
    if(!(this.posts.length > 0)){
      let loading = this.loadingCtrl.create();
      loading.present();
      this.wordpressService.getRecentPostsWithSort(this.categoryId,this.sort) 
      .subscribe(data => {
        for(let post of data){
          post.excerpt.rendered = post.excerpt.rendered.split('<a')[0] + "</p>";
          this.posts.push(post);
        }
        loading.dismiss();
      });
    }
  }

```

…

```
doInfinite(infiniteScroll) {
    let page = (Math.ceil(this.posts.length/10)) + 1;
    console.log("PAGE_"+page)
    console.log("this.posts.length_"+this.posts.length)
    let loading = true;

    this.wordpressService.getRecentPostsWithSort(this.categoryId,this.sort, page)
    .subscribe(data => {
      for(let post of data){
        if(!loading){
          infiniteScroll.complete();
          
        }
        post.excerpt.rendered = post.excerpt.rendered.split('<a')[0] + "</p>";
        this.posts.push(post);
        loading = false;
      }
    }, err => {
      this.morePagesAvailable = false; 
    }) 
  }  

```

doInfinite let me to implement infinite scroll, and all works well!

How is it possibile to integrate pull to refresh from the ionic documentation?  
This is a sample from the doc and I don’t understand how could I use it in my project.

```
doRefresh(refresher) {
    console.log('Begin async operation', refresher);

    setTimeout(() => {
      console.log('Async operation has ended');
      refresher.complete();
    }, 2000);
  }

```

Someone can help me?  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:34pm UTC](https://forum.ionicframework.com/t/integrate-the-pull-to-refresh-feature-in-ionic-3-with-wordpress/131077/2 "2021-07-19T21:34:57Z")

</div>


