-
Notifications
You must be signed in to change notification settings - Fork 0
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
3f02e5e
commit 96ccaa8
Showing
3 changed files
with
65 additions
and
1 deletion.
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
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,45 @@ | ||
<?php | ||
|
||
/* | ||
* Query posts for a relationship value. | ||
* This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array) | ||
*/ | ||
|
||
$get_wiki_programs = get_posts(array( | ||
'post_type' => 'program' | ||
)); | ||
|
||
if ($get_wiki_programs) { | ||
foreach ($get_wiki_programs as $get_wiki_program) { | ||
$get_wiki_phases = get_posts(array( | ||
'post_type' => 'phase', | ||
'meta_query' => array( | ||
array( | ||
'key' => 'program', // name of custom field | ||
'value' => '"' .$get_wiki_program->ID . '"', // matches exactly "123", not just 123. This prevents a match for "1234" | ||
'compare' => 'LIKE' | ||
) | ||
) | ||
)); | ||
|
||
var_dump($get_wiki_phases | ||
); | ||
|
||
if( $get_wiki_phases ): ?> | ||
<p><?php echo($get_wiki_program->post_title); ?></p> | ||
<ul> | ||
<?php foreach( $get_wiki_phases as $get_wiki_phase ): ?> | ||
|
||
<li> | ||
<!-- <p > The title of the file </p> --> | ||
<a href=" <?php echo get_permalink($get_wiki_phase->ID); ?>"> <?php echo $get_wiki_phase->post_title; ?> </a> | ||
|
||
</li> | ||
<?php endforeach; ?> | ||
</ul> | ||
<?php endif; | ||
|
||
} | ||
} | ||
|
||
|