Guest User

Untitled

a guest
Aug 4th, 2017
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 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 ( is_null( $content ) || empty( $content ) ) {
  23. $content = $atts[ 'content' ];
  24. }
  25.  
  26. $buffy = '';
  27. $buffy .= '<div class="' . $this->get_block_classes() . '" ' . $this->get_block_html_atts() . '>';
  28.  
  29. //get the block js
  30. $buffy .= $this->get_block_css();
  31.  
  32. // block title wrap
  33. $buffy .= '<div class="td-block-title-wrap">';
  34. $buffy .= $this->get_block_title();
  35. $buffy .= $this->get_pull_down_filter(); //get the sub category filter for this block
  36. $buffy .= '</div>';
  37.  
  38. $buffy .= '<div class="td_mod_wrap">';
  39. // //only run the filter if we have visual composer
  40. // if ( ! ( td_util::tdc_is_live_editor_iframe() || td_util::tdc_is_live_editor_ajax() ) ) {
  41. // if (function_exists('wpb_js_remove_wpautop')) {
  42. // $buffy .= wpb_js_remove_wpautop( $content );
  43. // } else {
  44. // $buffy .= do_shortcode( shortcode_unautop( $content ) );
  45. // }
  46. // } else {
  47. // $buffy .= $content; //no visual composer
  48. // }
  49.  
  50. // As vc does
  51. $content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
  52.  
  53. if ( ! ( td_util::tdc_is_live_editor_iframe() || td_util::tdc_is_live_editor_ajax() ) ) {
  54. $content = do_shortcode( shortcode_unautop( $content ) );
  55. }
  56.  
  57. $buffy .= $content;
  58.  
  59.  
  60. $buffy .= '</div>';
  61. $buffy .= '</div>';
  62.  
  63. return $buffy;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment