• Resolved Windurin

    (@windurin)


    Hi,

    I’m a little confused about setting up required steps for Custom Post Types. For a start, all my Custom Post Types actually appear in the dropdown list on any ‘…of a type’ triggers such as ‘Comment on a post of a type’ or ‘Publish a new post of a type’.

    Yet these don’t work. So following the snippet found here:

    https://gamipress.com/snippets/expansions/events-for-create-and-delete-a-cpt/

    I was able to get the triggers to work for a Custom Post Type specified there. So what is the purpose of that ‘…of a type’ trigger if it doesn’t actually recognise any of the Custom Post Types in the list?

    The snippet linked above also only has triggers for Publishing and Deleting custom post types. How can I register a trigger for Commenting on that custom post type?

    I tried this for example but it didn’t work:

    "gamipress_new_comment_{$my_prefix_post_type}" => sprintf( __( 'Comment on a %s', 'gamipress' ), $post_type->labels->singular_name ),

    Finally, is it possible to add multiple custom post types here in an array instead of creating a new snippet for every post type? What would the formatting be for that?

    Thanks very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ruben Garcia

    (@rubengc)

    Hi @windurin

    I just used the built-in events on GamiPress and they work correctly for custom post types registered through code as well as through CPT UI plugin

    So, is probable that the issue comes in how YOUR custom post types are getting registered on your site

    Regarding the snippet, all snippet for our “Customize” section are focused to developers only, if you are not a developer I encourage you to do not use them in your way since a code modified incorrectly could break your site

    The most recommended is to contract a developer to add the modifications you need

    If you do not know one, we recommend checking our list of trusted experts that can estimate any type of job for you here:
    https://gamipress.com/customizations/

    Best regards

    Thread Starter Windurin

    (@windurin)

    Hi Ruben, thanks for the response.

    I am actually using CPT UI to register the custom post types.

    What I’m confused about is why there seem to be 2 options for getting Gamipress to work with custom post types? There’s the ‘post of a type…’ triggers under the WordPress section and then there’s the snippet here:

    https://gamipress.com/snippets/expansions/events-for-create-and-delete-a-cpt/

    Which creates a new section called ‘Custom Post Type Events’ in the dropdown box.

    The introduction to this snippet seems to suggest that custom post types won’t work with Gamipress out of the box, but as you pointed out, they do, or should do, under the ‘post of a type…’ option in the WordPress events if you’ve registered them in a standard WordPress way or used CPT UI. So is the info in the snippet outdated, or are you supposed to use both together?

    The Create event for the custom post types does work for the second option, and I did actually get it to work with the first option (selecting the same post type from the ‘post of a type…’ event in the standard WordPress section) eventually after I realised the achievement was set to only allow 1 per user, but strangely it’s only working for the 1 custom post type.

    The other post types are all registered in the same way, using CPTUI with the same options, so I’m not sure why the ‘post of a type…’ option is not working for them?

    The ‘Comment on a post of type…’ trigger is also not working for any of the custom post types. The only trigger that works is commenting on a *specific* post of that custom post type.

    Thanks, Chris.

    Plugin Author Ruben Garcia

    (@rubengc)

    Hi @windurin

    We released the snippet first a few years ago, but on latest updates of GamiPress we added the event for publish and comment on a CPT

    The snippet only works for create a delete CPT, not for commenting, and we keep it here for developers as example

    Regarding the events included on GamiPress, there are screenshots of how both events are working with CPT UI posts:

    View post on imgur.com

    So seems that your issue comes from a theme or plugin conflict so please, perform a conflict test to find which plugin is causing issues on your WordPress

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Post Type Comments’ is closed to new replies.