Advertisement
clicktap

Untitled

Feb 25th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // Element Class
  5. class vcAboutUsBlock extends WPBakeryShortCode {
  6.  
  7. // Element Init
  8. function __construct() {
  9. add_action( 'init', array( $this, 'vc_element_mapping' ) );
  10. add_shortcode( 'vc_whoweare', array( $this, 'vc_html' ) );
  11. }
  12.  
  13.  
  14.  
  15. public function vc_element_mapping() {
  16.  
  17.  
  18. vc_map(
  19.  
  20. array(
  21. 'name' => __('Who we are component', 'text-domain'),
  22. 'base' => 'vc_whoweare',
  23. 'description' => __('Block for creating new component inside about us page', 'text-domain'),
  24. 'category' => __('Custom Components', 'text-domain'),
  25. 'params' => array(
  26.  
  27. array(
  28. 'type' => 'textfield',
  29. 'holder' => 'h3',
  30. 'class' => 'title-class',
  31. 'heading' => __( 'Title', 'text-domain' ),
  32. 'param_name' => 'title',
  33. 'value' => __( 'Who we are', 'text-domain' ),
  34. 'description' => __( 'Box Title', 'text-domain' ),
  35. 'admin_label' => false,
  36. 'weight' => 0,
  37. ),
  38.  
  39. array(
  40. 'type' => 'textarea',
  41. 'holder' => 'div',
  42. 'class' => 'desc-class',
  43. 'heading' => __( 'Text', 'text-domain' ),
  44. 'param_name' => 'description',
  45. 'value' => __( 'About us', 'text-domain' ),
  46. 'description' => __( 'Box Text', 'text-domain' ),
  47. 'admin_label' => false,
  48. 'weight' => 0,
  49. ),
  50.  
  51. array(
  52. 'type' => 'attach_image',
  53. 'holder' => 'div',
  54. 'class' => 'image-class',
  55. 'heading' => __( 'Image 1', 'text-domain' ),
  56. 'param_name' => 'image1',
  57. 'admin_label' => false,
  58. 'weight' => 0,
  59. 'description' => __( 'Select image from media library.', 'text-domain' )
  60. ),
  61.  
  62. array(
  63. 'type' => 'attach_image',
  64. 'holder' => 'div',
  65. 'class' => 'image-class',
  66. 'heading' => __( 'Image 2', 'text-domain' ),
  67. 'param_name' => 'image2',
  68. 'admin_label' => false,
  69. 'weight' => 0,
  70. 'description' => __( 'Select image from media library.', 'text-domain' )
  71. )
  72. )
  73. )
  74. );
  75.  
  76. }
  77.  
  78.  
  79. public function vc_html( $atts ) {
  80.  
  81. // Params extraction
  82. extract(
  83. shortcode_atts(
  84. array(
  85. 'title' => 'About',
  86. 'description' => '',
  87. 'image1' => '',
  88. 'image2' => '',
  89. ),
  90. $atts
  91. )
  92. );
  93. $image_src1 = wp_get_attachment_image_src($image1,'large');
  94. $image_src2 = wp_get_attachment_image_src($image2,'large');
  95. // Fill $html var with data
  96. $html = '
  97. <section class="WhoSec" id="whois">
  98. <div class="container">
  99. <div class="WhoDiv">
  100. <div class="row">
  101. <div class="col-md-6 col-sm-12">
  102. <div class="WhoDivText">
  103. <h2 data-aos="fade-up" data-aos-duration="1000" data-aos-easing="ease-in-out">'.$title.'</h2>
  104. <p data-aos="fade-up" data-aos-duration="1000" data-aos-easing="ease-in-out">'.$description.'</p>
  105. </div>
  106. </div>
  107. <div class="col-md-6 col-sm-12">
  108. <div class="WhoDivImg">
  109. <div class="WhoDivImg">
  110. <div class="WhoDivImages">
  111. <img src="<?php echo get_template_directory_uri(); ?>/images/WhoDivImg1.jpg" alt="">
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </section>
  120.  
  121. <style>
  122.  
  123. </style>
  124. ';
  125. return $html;
  126.  
  127. }
  128. } // End Element Class
  129. new vcAboutUsBlock();
  130.  
  131. // Element Mapping
  132.  
  133. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement