Advertisement
arie_cristianD

override_block_2_view.php

Jul 25th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. public function render_block_type_2( $post, $image_size ) {
  2.         $post_id          = $post->ID;
  3.         $additional_class = ( ! has_post_thumbnail( $post_id ) ) ? ' no_thumbnail' : '';
  4.         $permalink        = get_the_permalink( $post );
  5.         $content = '<article ' . jnews_post_class( 'jeg_post jeg_pl_sm' . $additional_class, $post_id ) . '> '. "
  6.             <a href=\"{$permalink}\">".'
  7.                <div>
  8.                    <div class="jeg_thumb">
  9.                        '. "
  10.                            {$this->get_thumbnail($post_id, $image_size)}
  11.                    </div>
  12.                    <div class=\"jeg_postblock_content\">
  13.                        <h3 class=\"jeg_post_title\">
  14.                            ". get_the_title( $post ) . "
  15.                        </h3>
  16.                        {$this->post_meta_2($post)}
  17.                    </div>
  18.                </div>
  19.                </a>
  20.                </article>";
  21.             $updatedContent = preg_replace_callback('/<a[^>]*>(.*?)<\/a>/i', function ($matches) {
  22.                 $content = $matches[1];
  23.                 return '<div>' . $content . '</div>';
  24.             }, $content);
  25.             return $updatedContent ;
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement