Title: Example Code
Last modified: October 5, 2017

---

# Example Code

 *  Resolved [James Hunt](https://wordpress.org/support/users/bonkerz/)
 * (@bonkerz)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/example-code-2/)
 * Hey man, great plugin and thanks for taking initiative to replace P2P
 * I noticed your 3rd demo code for the plugin `('posts_per_page' = 5)` throws back
   the error – `Parse error: syntax error, unexpected '=', expecting ')'`
 * I’m struggling with getting the code working on multiple pages (inserting $id
   instead of manually writing the post ID) – any tips?
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [neatek](https://wordpress.org/support/users/neatek/)
 * (@neatek)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/example-code-2/#post-9558759)
 * hello,
 *     ```
       <?php
           $args = array(
               'posts_per_page' => 5
           );
           $c_posts = npc_get_connected($id, 'needed_post_type', $args);
           var_dump($c_posts);
       ?>
       ```
   
 * or just without $args
 *     ```
           $c_posts = npc_get_connected($id, 'needed_post_type');
           var_dump($c_posts);
       ```
   
    -  This reply was modified 8 years, 7 months ago by [neatek](https://wordpress.org/support/users/neatek/).
    -  This reply was modified 8 years, 7 months ago by [neatek](https://wordpress.org/support/users/neatek/).
 *  Plugin Author [neatek](https://wordpress.org/support/users/neatek/)
 * (@neatek)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/example-code-2/#post-9566171)
 * No answer from bonkerz. Solved
    -  This reply was modified 8 years, 7 months ago by [neatek](https://wordpress.org/support/users/neatek/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Example Code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/npc-neatekpostconnect.svg)
 * [[NPC] Neatek Post Connect (many-to-many)](https://wordpress.org/plugins/npc-neatekpostconnect/)
 * [Support Threads](https://wordpress.org/support/plugin/npc-neatekpostconnect/)
 * [Active Topics](https://wordpress.org/support/plugin/npc-neatekpostconnect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/npc-neatekpostconnect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/npc-neatekpostconnect/reviews/)

## Tags

 * [solved](https://wordpress.org/support/topic-tag/solved/)

 * 2 replies
 * 2 participants
 * Last reply from: [neatek](https://wordpress.org/support/users/neatek/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/example-code-2/#post-9566171)
 * Status: resolved