kalponikoronno

Visual Composer template making

Dec 11th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. if(!defined('ABSPATH')) die('-1');
  4.  
  5. add_filter( 'vc_load_default_templates', 'my_custom_template_modify_array' ); // Hook in
  6. function my_custom_template_modify_array( $data ) {
  7.     return array(); // This will remove all default templates. Basically you should use native PHP functions to modify existing array and then return it.
  8. }
  9.  
  10. function seo_vc_homepage() {
  11.     $data               = array(); // Create new array
  12.     $data['name']       = __( 'Seo Homepage', 'seo' ); // Assign name for your custom template
  13.     $data['weight']     = 0; // Weight of your template in the template list
  14.     $data['image_path'] = preg_replace( '/\s/', '%20', plugins_url( 'images/custom_template_thumbnail.jpg', __FILE__ ) );
  15.     $data['content']    = <<<CONTENT
  16.        
  17.         /* here is shortcode  */
  18.  
  19. CONTENT;
  20.  
  21.     vc_add_default_templates( $data );
  22. }
  23.  
  24. add_action( 'vc_load_default_templates_action','seo_vc_homepage' ); // Hook in
Advertisement
Add Comment
Please, Sign In to add comment