• Resolved gabegabe

    (@gabegabe)


    Hi Support

    I am trying to install your plugin.
    I get this error:

    Fatal error: Cannot declare class CRP_Widget, because the name is already in use in /home/agenziag/public_html/wp-content/plugins/contextual-related-posts/includes/modules/class-crp-widget.php on line 0

    Maybe it could be due to a conflict with the plugin Custom Related Posts already installed in my wordpress? Could it be that the widget component class-crp-widget.php has the same name?

    Thank You

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

    (@ajay)

    I have a feeling that could be the case. If you’d like to use both plugins, you might need to either rename all instances of the function CRP_Widget in either the file above as well as one instance in header.php line 37

    In the next version, I’ll put a wrapping `if ( ! class_exists( ‘CRP_Widget’ ) ) :
    `
    in my plugin. In both cases you won’t have the error, but in the latter case it means the widget of my plugin won’t work.

    Obviously, you could also switch over and use the Manual posts option in my plugin which is in the metabox at the bottom of your edit posts screen.

    Thread Starter gabegabe

    (@gabegabe)

    Dear Ajay

    I’d like tu use both posts:

    Contextual Related Posts
    for AUTOMATICALLY related posts

    Custom Related Posts
    for MANUALLY easy visual define relations in ONE or BOTH ways on the post edit page

    I don’t know how to go about making your suggested change.
    Also, would this change survive to any future plugin updates?

    Thank You

    Plugin Author Ajay

    (@ajay)

    In the next update, I’m wrapping the CRP_Widget into an if class_exists check to avoid the error.

    This has been in the plugin for a long time, I don’t plan to change anything besides that.

    You can continue to use CRP but depending on how WP processes activation the widget may or may not be available. But, all other functionality including the automatic addition, gutenberg blocks, shortcode etc.

    You could potentially use the shortcode in an HTML/Text widget as well if I am not mistaken.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot declare class CRP_Widget, because the name is already in use’ is closed to new replies.