Title: Creating a custom module
Last modified: August 31, 2016

---

# Creating a custom module

 *  Resolved [xberg](https://wordpress.org/support/users/xberg/)
 * (@xberg)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/)
 * Hi
    I am struggling to create a custom module “photo details” as a child of post.
 * 1. I cloned post_most_popular.php in /src/modules and changed:
    `class BWP_GXS_MODULE_POST_PHOTO_DETAILS
   extends BWP_GXS_MODULE` Called this post_photo_details.php and also saved in /
   src/modules
 * 2. In my theme’s functions.php added:
 *     ```
       add_action('bwp_gxs_modules_built', 'bwp_gxs_add_modules');
       function bwp_gxs_add_modules()
       {
           global $bwp_gxs;
           $bwp_gxs->add_module('post', 'photo_details');
       }
       ```
   
 * That’s it. I then expected a new line “photo Details” to appear in the config?
   Or even a new XML sitemap.
 * I also tried to move the post_photo_details.php into a custom directory and define
   that directory in the Advanced Options. But still no success: I see nothing in
   the config.
    What am I doing wrong?
 * [https://wordpress.org/plugins/bwp-google-xml-sitemaps/](https://wordpress.org/plugins/bwp-google-xml-sitemaps/)

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

 *  Thread Starter [xberg](https://wordpress.org/support/users/xberg/)
 * (@xberg)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216320)
 * I tried changing my hook in functions.php and also adding the line you have in
   your demo code, but neither of these has any impact:
 *     ```
       add_action('bwp_gxs_modules_built', 'bwp_gxs_add_modules');
       function bwp_gxs_add_modules()
       {
           global $bwp_gxs;
           $bwp_gxs->add_module('post', 'post_photo_details');
           $bwp_gxs->add_module('post', 'most popular');
       }
       ```
   
 *  Thread Starter [xberg](https://wordpress.org/support/users/xberg/)
 * (@xberg)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216332)
 * I got it to work.
    I simply had to type in my browser myurl/photo_details.xml
   to make it work.
 *  Plugin Author [Khang Minh](https://wordpress.org/support/users/oddoneout/)
 * (@oddoneout)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216502)
 * You should see post_photo_details in your sitemapindex.xml file, it will not 
   show up in config though. Perhaps you have sitemap cache enabled?
 *  Thread Starter [xberg](https://wordpress.org/support/users/xberg/)
 * (@xberg)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216508)
 * Thanks. Yes: I had the cache enabled. It did not cross my mind that this would
   have an impact. All good now, you can close this ticket.
    Great work on the plugin:
   I love it!
 *  Plugin Author [Khang Minh](https://wordpress.org/support/users/oddoneout/)
 * (@oddoneout)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216509)
 * Glad you like the plugin :-). Look like I have to add a warning about sitemap
   cache somewhere.
 * Btw, you can still force a regeneration of the sitemapindex by clicking on the“
   refresh” icon while having sitemap cache enabled.

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

The topic ‘Creating a custom module’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/bwp-google-xml-sitemaps_fffefe.svg)
 * [Better WordPress Google XML Sitemaps (support Sitemap Index, Multi-site and Google News)](https://wordpress.org/plugins/bwp-google-xml-sitemaps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bwp-google-xml-sitemaps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bwp-google-xml-sitemaps/)
 * [Active Topics](https://wordpress.org/support/plugin/bwp-google-xml-sitemaps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bwp-google-xml-sitemaps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bwp-google-xml-sitemaps/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Khang Minh](https://wordpress.org/support/users/oddoneout/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/creating-a-custom-module/#post-7216509)
 * Status: resolved