Create “new pages” within the admin section of plugin

The easiest way is to add another $_GET parameter to the URL. In the moment you are viewing admin.php?page=Customer_Search. You could make your links go like admin.php?page=Customer_Search&type=your-page. In your plugins files you can then output the desired content based on that parameter. if($_GET[‘type’] == ‘your-page’) { //output your page … }elseif( ….other pages …

How to get the number of pages when paginating comments?

Try get_comment_pages_count()? <?php get_comment_pages_count( $comments, $per_page, $threaded); ?> I’m guessing you’re outside the loop, since you’re calling get_comments(); in that case, you’ll need to pass your $comments object: $comments = get_comments(array( ‘post_id’ => $post_id, ‘status’ => ‘approve’ )); wp_list_comments(array( ‘page’ => 1, ‘per_page’ => 10, ‘avatar_size’ => 16, ), $comments); $comment_page_count = get_comment_pages_count( $comments );

Using flickr api in custom wordpress plugin

I see two issues right off the bat that are going to cause problems: $this->myApiKey = $flickr_key; $thix->myApiSecret = $flickr_secret; myApiKey and myApiSecret aren’t in your code anywhere, so setting them here isn’t doing anything. They should be $this->flickr_key and $this->flickr_secret. You have a typo in the 2nd line above. Change $thix to $this and … Read more

CPT to installable Plugin

There are other factors that you’ll discover along the way, but basically it boils down to: move all that’s CPT related from your theme’s functions.php to a plugin file. Create a PHP file, put the plugin’s header information, add to the plugins folder, activate. Now, you separated appearance (theme) from functionality (plugin). Here are two … Read more

Display my plugins content based on a pages post_id

How you do this could be more or less hard depending on where the content is supposed to be included in the page, and you don’t explain that, but assuming you are including it in the post body… add_filter( ‘the_content’, function($content) { global $post; $db_showmap_options = get_option( ‘db_showmap_options’ ); if (!empty($db_showmap_options[‘page_id’]) && $post->ID == $db_showmap_options[‘page_id’]) … Read more