Home › Forums › Front-end Issues › Issues creating related posts to multiple CPT and display radio buttons select c
Hi,
I’m trying to create a related posts to be display in some CPT and native Pages WordPress.
So, I have created a field name: Artistes News
Field Type: Type Post Object
Filter by Post Type: Page, CPT, CPT
Selected multiple values? : YES
Return Format: Post ID
Location is equal: POST
That way, when an author writes some posts he can assign them to multiple players.
I’m messing around with the code but I’m not enable to populate into my CPT. Can you please share the tip ?
In another filed group I have some taxonomy type radio buttons and I’m not able to display them into my template page.
Please note that, if I set Term ID I get numbers instead of content and if I set Term Object I get a blank page.
Please check the 2 print screen and kindly share the code to fix these problems.
Thanks,
I’m afraid I can’t see the screenshots. Could you please re-upload it?
Regarding the post object, please take a look at this page: http://www.advancedcustomfields.com/resources/post-object/.
Regarding the taxonomy, please take a look at this page: http://www.advancedcustomfields.com/resources/taxonomy/.
I hope this helps.
I have reply to this message by mail the same day and still waiting for answers
This is my code. My issues concert the else statement. I should be able to display in every Costum Post Type the related posts and for that, I need multiple options values set on.
At this moment, only type_portfolio works with single posts assigned, I mean with multiple options value set NO.
Please, URGENT
<?php
if(is_singular(‘type_portfolio’)) {
$args = array(
‘post_type’ => ‘post’,
‘meta_key’ => ‘services’,
‘meta_value’ => get_the_ID()
);
} else {
$args = array(
‘post_type’ => ‘post’,
‘posts_per_page’ => get_option(‘posts_per_page’)
);
}
$the_query = new WP_Query( $args );
$templ = “home”;
$cssclass= “grid-33 tablet-grid-100 mobile-grid-100 prefix-33 suffix-33″;
if ( $the_query->have_posts() ) {
?>
<div class=”jcarouselb”>
<span class=”fa-stack fa-lg”><i class=”fa fa-square fa-stack-2x”></i><i class=”fa fa-chevron-left fa-stack-1x”></i></span>
<span class=”fa-stack fa-lg”><i class=”fa fa-square fa-stack-2x”></i><i class=”fa fa-chevron-right fa-stack-1x”></i></span>
</div>
<?php
}
wp_reset_postdata();
?>
Could you please answer the thread from the forum page, not the email.
Regarding your issue, multiple post objects field is saved in a serialized data like this: a:3:{i:0;s:3:"810";i:1;s:3:"135";i:2;s:3:"814";}
.
With your query arguments, it won’t match any serialized data. You need the arguments like this:
$args = array(
'numberposts' => -1,
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'services',
'value' => serialize(strval(get_the_ID())),
'compare' => 'LIKE'
),
)
);
I hope this helps.
The topic ‘Issues creating related posts to multiple CPT and display radio buttons select c’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.