Guest User

Untitled

a guest
May 4th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <?php
  2.  
  3. class td_block_text_with_title extends td_block {
  4.  
  5. /**
  6. * Disable loop block features. This block does not use a loop and it dosn't need to run a query.
  7. */
  8. function __construct() {
  9. parent::disable_loop_block_features();
  10. }
  11.  
  12.  
  13. function render($atts, $content = null) {
  14. parent::render($atts); // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query
  15.  
  16. $atts = shortcode_atts(
  17. array(
  18. 'content' => __('Html code here! Replace this with any non empty text and that\'s it.', TD_THEME_NAME ),
  19. 'el_class' => '',
  20. ), $atts, 'td_block_text_with_title' );
  21.  
  22. if (td_util::tdc_is_live_editor_iframe() || td_util::tdc_is_live_editor_ajax() ) {
  23. if (is_null($content) || empty($content)) {
  24. $content = $atts['content'];
  25. }
  26. }
  27.  
  28. $buffy = '';
  29. $buffy .= '<div class="' . $this->get_block_classes() . '" ' . $this->get_block_html_atts() . '>';
  30.  
  31. //get the block js
  32. $buffy .= $this->get_block_css();
  33.  
  34. // block title wrap
  35. $buffy .= '<div class="td-block-title-wrap">';
  36. $buffy .= $this->get_block_title();
  37. $buffy .= $this->get_pull_down_filter(); //get the sub category filter for this block
  38. $buffy .= '</div>';
  39.  
  40. //td-fix-index class to fix background color z-index
  41. $buffy .= '<div class="td_mod_wrap td-fix-index">';
  42. // //only run the filter if we have visual composer
  43. // if ( ! ( td_util::tdc_is_live_editor_iframe() || td_util::tdc_is_live_editor_ajax() ) ) {
  44. // if (function_exists('wpb_js_remove_wpautop')) {
  45. // $buffy .= wpb_js_remove_wpautop( $content );
  46. // } else {
  47. // $buffy .= do_shortcode( shortcode_unautop( $content ) );
  48. // }
  49. // } else {
  50. // $buffy .= $content; //no visual composer
  51. // }
  52.  
  53. // As vc does
  54. $content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
  55.  
  56. if ( ! ( td_util::tdc_is_live_editor_iframe() || td_util::tdc_is_live_editor_ajax() ) ) {
  57. $content = do_shortcode( shortcode_unautop( $content ) );
  58. }
  59.  
  60. $buffy .= $content;
  61.  
  62.  
  63. $buffy .= '</div>';
  64. $buffy .= '</div>';
  65.  
  66. return $buffy;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment