• Resolved xberg

    (@xberg)


    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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter xberg

    (@xberg)

    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

    (@xberg)

    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

    (@oddoneout)

    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

    (@xberg)

    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

    (@oddoneout)

    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.