-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7957d76
commit b111f10
Showing
11 changed files
with
241 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Fields; | ||
|
||
use Log1x\AcfComposer\Builder; | ||
use Log1x\AcfComposer\Field; | ||
|
||
class ExtraLinks extends Field | ||
{ | ||
/** | ||
* The field group. | ||
*/ | ||
public function fields(): array | ||
{ | ||
$extraLinks = Builder::make('extra_links'); | ||
|
||
$extraLinks | ||
->setLocation('post_type', '==', 'post'); | ||
|
||
$extraLinks | ||
->addLink('external_link'); | ||
|
||
return $extraLinks->build(); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use Livewire\Component; | ||
|
||
class AsyncQuery extends Component | ||
{ | ||
public $posts = []; | ||
public $posts_links = []; | ||
|
||
public function getPosts(){ | ||
$posts = get_posts(); | ||
if($posts){ | ||
foreach($posts as $post){ | ||
$this->posts[] = [ | ||
'title' => $post->post_title, | ||
'link' => get_field('external_link', $post->ID), | ||
'id' => $post->ID, | ||
'slug' => $post->post_name, | ||
'date' => $post->post_date, | ||
'content' => $post->post_content, | ||
'excerpt' => $post->post_excerpt, | ||
'status' => $post->post_status, | ||
'type' => $post->post_type, | ||
'author' => $post->post_author, | ||
'modified' => $post->post_modified, | ||
'modified_gmt' => $post->post_modified_gmt, | ||
'comment_status' => $post->comment_status, | ||
'comment_count' => $post->comment_count, | ||
'thumbnail' => get_the_post_thumbnail($post->ID, 'thumbnail') | ||
]; | ||
} | ||
} | ||
} | ||
|
||
public function getPostsLinks(){ | ||
$posts = get_posts(); | ||
if($posts){ | ||
foreach($posts as $post){ | ||
$this->posts_links[] = get_field('external_link', $post->ID); | ||
} | ||
} | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.async-query'); | ||
} | ||
} |
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
<!doctype html> | ||
<html <?php language_attributes(); ?>> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<?php wp_head(); ?> | ||
</head> | ||
|
||
<?php echo view(app('sage.view'), app('sage.data'))->render(); ?> | ||
|
||
</html> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div> | ||
<div class="title">Posts</div> | ||
<pre> | ||
{{print_r($posts)}} | ||
</pre> | ||
<div class="title">Posts external links</div> | ||
<pre> | ||
{{print_r($posts_links)}} | ||
</pre> | ||
<div class="button is-primary" wire:click="getPosts">get posts</div> | ||
<div class="button is-dark" wire:click="getPostsLinks">get posts external links</div> | ||
</div> |