This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Sua API | |
| let postsApi = 'http://meusite.com/wp-json/wp/v2/posts' | |
| //Jovemnerd | |
| //let postsApi = 'https://jovemnerd.com.br/wp-json/wp/v2/posts' | |
| //B9 | |
| //let postsApi = 'https://www.b9.com.br/wp-json/wp/v2/posts/' | |
| let posts = Http |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Http = { | |
| inicia: (postsAPI) => Http._pega(postsAPI), | |
| _pega: (postsAPI) => { | |
| fetch(postsAPI,{method:'get'}) | |
| .then(res => res.json()) | |
| .then(posts => Http._monta(posts), err => { | |
| let template = ` | |
| <span style="color:red"> | |
| Esse servidor não fornece permissão para consumo de sua API | |
| </span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Aplicação</title> | |
| </head> | |
| <body> | |
| <div class="posts"></div> | |
| <script src="modules/Http.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $query = new WP_Query([“posts_per_page” => -1]); | |
| while ( $query->have_posts() ): $query->the_post(); | |
| //acesso as informações | |
| endwhile; wp_reset_postdata(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="btn clear--fix">button</div> | |
| <div class="btn--color-red float--left">button</div> | |
| <div class="btn--size-large text--center">button</div> | |
| <div class="btn--color-red--size-large is--enable">button</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="btn clear -fix">button</div> | |
| <div class="btn -color-red float -left">button</div> | |
| <div class="btn -size-large text -center">button</div> | |
| <div class="btn -color-red -size-large is -enable">button</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .btn | |
| background #ccc | |
| color #000 | |
| width 100px | |
| padding 10px 20px | |
| font-size 16px | |
| text-align center | |
| .-color-red | |
| color red | |
| .-size-large |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="btn">button</div> | |
| <div class="btn -color-red">button</div> | |
| <div class="btn -size-large">button</div> | |
| <div class="btn -color-red -size-large">button</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .btn | |
| background #ccc | |
| color #000 | |
| width 100px | |
| padding 10px 20px | |
| font-size 16px | |
| text-align center | |
| /[class*="--color-red"] | |
| @extend .btn | |
| color red |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .btn | |
| background #ccc | |
| color #000 | |
| width 100px | |
| padding 10px 20px | |
| font-size 16px | |
| text-align center | |
| &--color-red | |
| color #f00 | |
| &--size-large |
NewerOlder