Ask your WordPress questions! Pay money and get answers fast! (more info)

ACF : Please show all post by Post Object

  • REFUND REQUESTED

Dear friend

Please help me to show all post in post,

1. Create Category 1.
2. Create Category 2.

Use ACF : POST_OBJECT for all post of Category 2 with selection post of Category 1.

How to show all post use Post Object of Category 2 in single post of Category 1 .



I use this code but not working fine :


<?php
$title = get_the_title ();
$fields = get_field('field_name');
$args = array (
'meta_key' => $fields,
'meta_value' => $title,
'compare' => 'LIKE'
);
query_posts( $args );
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_query();
?>




Please help me !

Answers (1)

2015-04-22

Arnav Joy answers:

<?php
$title = get_the_title ();
$fields = get_field('field_name');
$args = array (
'cat' => $fields,
'posts_per_page' => -1
);
query_posts( $args );
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_query();
?>


qdungeng comments:

Thanks for reply soon, but this code not working.

<?php
$title = get_the_title ();
$fields = get_field('field_name');
$args = array (
'cat' => $fields,
'posts_per_page' => -1
);
query_posts( $args );
while ( have_posts() ) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_query();
?>


Arnav Joy comments:

I think I have misunderstood your question , can you describe it more?


qdungeng comments:

Thanks for reply soon.

Example :

Category 1 :
- post 1
- post 2
- post 3
Category 2 :
- post 4
- post 5
- post 6

How to show related post the same title when usd Post Object.

Single Post 1
-------------------------------
- Post 1
Content

Related post :
-post 4
- post 6
-------------------------------

Single Post 2
-------------------------------
- Post 2
Content

Related post :
- post 5
-------------------------------


Thanks


Arnav Joy comments:

how you are making related posts?


qdungeng comments:

Do you have Skype ?


Arnav Joy comments:

yes its : arnav.joy


qdungeng comments:

I did chat via Skype, but you not answer, my skype name : qdungeng