How to make global Post Tags?

If you want to have shared post tags, you can do it by this:

  • Camaleon version >= 2.4.4.2
  • Create an initializer: my_app/config/initializers/shared_tags.rb
    Rails.application.config.to_prepare do
    CamaleonCms::PostType.class_eval do
    # Return all post tags of current site rather than post tags of current post type.
    def post_tags
    site.post_tags
    end
    end
    CamaleonCms::PostTag.class_eval do
    before_create :set_custom_parent_posttype

    # on creating a new post tag auto assign parent post type ID
    def set_custom_parent_posttype
    self.parent_id = post_type.id unless parent_id.is_a?(Integer)
    end
    end
    end

  • Restart server and enjoy!
Created at: 30 Sep 11:53 | Updated at: 02 Oct 15:04