Creating a New Share Button
If you want to add a new share button within posts, knowing where to start can be intimidating.
To start the process, you need to create a new template to hold your custom HTML code.
- In the AdminCP go to Styles → Style Manager.
- Select your style row and go to the Choose Action drop down. Note: If you are creating a product (see below), you should choose the MASTER STYLE which will be in the list while the site is in Debug Mode.
- Select “Add New Template” from the drop down.
- Add your custom code.
- Give the template a name. Something like “display_linkedin_share” would be appropriate but it can be anything you want.
- Save this new template.
- If you use multiple templates, then repeat for each style or create a product to hold the template in the MASTER STYLE (see below)
In order to show your new template it needs to be tied to a template hook. These are small pieces of code within vBulletin that tells the system to find and include any template at specific locations. For a share button, the hook that you want to use is conversation_share.
- Go to Products and Hooks → Manage Templates Hooks
- Click on “Add New Hook”
- If using a Product (see below) select your product from the drop down.
- Set the Hook Location to “conversation_sharing”
- Give it a name like “LinkedIn Share” or whatever you want.
- Set the template name to the template that you created above.
- Save the Hook.
- This should give you a working link in each post. If you want to style it like the others then look at the b-sharing-menu* CSS in the default templates.
Note: This creating Products is not available on vBulletin Cloud. However, the other portions can be completed on vBulletin Cloud.
Products allow you to apply more permanence to your changes. When you upgrade vBulletin, there is a possibility for your changes to be erased because they are assigned to the vBulletin product by default. During an upgrade, some parts of the system are replaced with new objects. This includes unedited templates, phrases, settings, and permissions.
Creating your own product provides a wrapper that protects your customizations. A product also allows you to easily apply your changes to every style or language, even ones added in the future.
- Put your site into Debug Mode
- Go to Products & Hooks.
- Click Add New Product.
- Give it a Product ID. All lower case, no spaces.
- Give it a title.
- The rest is optional.
- Save your Product.
- Complete the steps for creating a template and hook above.