๋ฒ๊ทธ ์ค๋ช
์ด๋ฆ์ด "team_member"์ธ ํฌ๋๊ฐ ์์ต๋๋ค. pods ๊ธฐ๋ฅ์ ์ฌ์ฉํ ๋ ๊ฒ์๋ฌผ์ด ํฌํจ๋์ง ์์ต๋๋ค. ์ด๊ฒ์ ๋ด ์ฝ๋์ ์ถ๋ ฅ์
๋๋ค.
$team_members = pods('team_member');
echo 'total: '. ($team_members->total()); //displays 'total: ' - no output from the function
if ( $team_members->total() > 0 ):
while ( $team_members->fetch() ):
echo 'hello'; //is never displayed
endwhile;
endif;
WP_Query
์ฌ์ฉํ ๋ ์์๋๋ ์ถ๋ ฅ์ ์ป์ต๋๋ค.
$args = (array('post_type' => 'team_member'));
$team_members = new WP_Query($args);
while ($team_members->have_posts()):
$team_members->the_post();
the_title(); //the title of each pod post is displayed
endwhile;
์ ํ์๋ ์๋ํ๊ณ ์ ์๋ ์๋ํ์ง ์์ต๋๊น?
๊ฐ์ฒด๋ฅผ ์ด์์ง๋ง ๋งค๊ฐ ๋ณ์๋ฅผ ์ง์ ํ์ง ์์์ผ๋ฏ๋ก ๊ธฐ๋ณธ์ ์ผ๋ก ํด๋น ์ง์ ์ ํฌ์ธํฐ๊ฐ ์๋ ๊ฐ์ฒด์
๋๋ค(์: $args ์์ด WP_Query ์ด๊ธฐ). ์ต์ํ $params = (array('limit' => '-1'));
์ ์ค์ ํ๊ณ ์ฒซ ๋ฒ์งธ ์ค์ $team_members = pods('team_member',$params);
๋ก ํธ์ถํ๋ ค๊ณ ํฉ๋๋ค.
https://pods.io/docs/code/pods/
https://pods.io/docs/code/pods/find/ << ๋ํ ๋ชจ๋ ์ฟผ๋ฆฌ ์ ํ ๋งค๊ฐ๋ณ์๋ฅผ ์ ๋ฌํ๋ ๋ฐ ๋งค์ฐ ์ ์ฉํฉ๋๋ค.
@jnaklaas ๊ฐ ์๋ํ์ต๋๊น?
๊ทธ๋ฌ์ด, ๊ฑด๋ฐฐ!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ทธ๋ฌ์ด, ๊ฑด๋ฐฐ!