{"id":7398,"date":"2014-06-12T03:10:28","date_gmt":"2014-06-12T03:10:28","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/12\/getting-items-in-metabox-which-was-created-by-plugin-collection-of-common-programming-errors\/"},"modified":"2014-06-12T03:10:28","modified_gmt":"2014-06-12T03:10:28","slug":"getting-items-in-metabox-which-was-created-by-plugin-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/12\/getting-items-in-metabox-which-was-created-by-plugin-collection-of-common-programming-errors\/","title":{"rendered":"Getting items in metabox which was created by plugin-Collection of common programming errors"},"content":{"rendered":"<p>i have a plugin and in there team members can be added. its actually a list of some members. now i have created a metabox for pages. in this metabox i want to show those members name in a select box to chose. so that those member will show up in that page. in the metabox code i am trying to get the members like this:<\/p>\n<pre><code>$post_type2 = 'team';\n    $orderby2 = 'menu_order';\n    $order2 = 'ASC';\n    $posts_per_page2 = 100;\n    $query2 = new WP_Query( array ( \n        'post_type'      =&gt; $post_type2,\n        'posts_per_page' =&gt; $posts_per_page2,\n        'orderby'        =&gt; $orderby2, \n        'order'          =&gt; $order2,\n        'no_found_rows'  =&gt; 1\n        ) \n    );\n    \/\/Get post type count\n    $members = array();\n    $members2 = array();\n    $post_count2 = $query2-&gt;post_count;\n    if( $post_count2 &gt; 0) :\n        while ($query2-&gt;have_posts()) :\n            $query2-&gt;the_post();\n            $members2['mid'] = get_the_id();\n            $members2['mname'] = get_the_title();\n            $members[] = $members2;\n            \/\/echo the_id();\n        endwhile;\n    endif;\n<\/code><\/pre>\n<p>but it messing up with the page itself. i can get the members, but the name of the page is changed to member&#8217;s name. my page is &#8220;home&#8221; and in the title area, it shows jhon doe &#8211; member name. any idea why? i think i am using the wrong &#8220;get&#8221; method to get the items.<\/p>\n<p><strong>The idea:<\/strong><br \/>\nThe team plugin adds some member. I want to show these members in pages. But not same members in all pages. For example: &#8220;john doe&#8221; can be appear in &#8220;about&#8221; page but not in &#8220;service&#8221; page. Like this. Thats why I was thinking of creating metabox in pages to choose members. Is this the right way to do that? Or any other idea??<\/p>\n","protected":false},"excerpt":{"rendered":"<p>i have a plugin and in there team members can be added. its actually a list of some members. now i have created a metabox for pages. in this metabox i want to show those members name in a select box to chose. so that those member will show up in that page. in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7398","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7398"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7398\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}