File manager - Edit - /home/carfac/public_html/rephotonet/wordpress/wp-content/plugins/royal-addons/shortcodes/blog.php
Back
<?php // Blog posts ([blog]) class Royal_Shortcode_Blog { public static function blog( $atts, $content = null ) { extract( shortcode_atts( array( 'column' => '1/4', 'limit' => '3' ), $atts ) ); if ( $column == '1/2' ) { $count_string = 'two'; } else if ( $column == '1/3' ) { $count_string = 'four'; } else { $count_string = 'three'; } $output = ''; $query = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => intval( $limit ) ) ); if ( $query->have_posts( ) ) { while ( $query->have_posts( ) ) { $query->the_post( ); $post_title = get_the_title( ); $attr_title = the_title_attribute( array( 'before' => '', 'after' => '', 'echo' => false ) ); $format = get_post_format( get_the_ID( ) ); $format_css = 'responsive-images'; if ( $format == 'status' ) { $format_css = 'format-holder status'; } else if ( $format == 'link' ) { $format_css = 'format-holder link'; } else if ( $format == 'aside' ) { $format_css = 'format-holder aside'; } if ( $format != 'gallery' ) { $post_content = apply_filters( 'the_content', wpautop( get_the_content( esc_html__( 'Read More', 'royal-addons' ) ) ) ); } else { $post_content = Royal_Theme::royal_post_gallery( esc_html__( 'Read More', 'royal-addons' ), false ); } $output .= ' <article id="post-' . esc_attr( get_the_ID( ) ) . '" class="' . esc_attr( implode( ' ', get_post_class( 'blog-post masonry offsetTopS offsetBottom', get_the_ID( ) ) ) ) . '"> <header> ' . ( ! empty( $post_title ) ? '<h3><a href="' . esc_url( get_the_permalink( ) ) . '" title="' . $attr_title . '">' . esc_html( $post_title ) . '</a></h3>' : '' ) . ' <div class="info"> ' . Royal_Theme::royal_post_categories( get_the_ID( ), '<span>', '</span>', false ) . ' </div> </header> <div class="responsive-images"> ' . $post_content . ' </div> </article>'; } } else { wp_reset_postdata( ); return ''; } wp_reset_postdata( ); return '<div class="row"><div class="col-md-12 col-sm-12 blog-masonry blog-masonry-' . esc_attr( $count_string ) . '">' . $output . '</div></div>'; } public static function vc_blog() { vc_map( array( "name" => esc_html__( "Blog Posts", "royal-addons" ), "base" => "blog", "icon" => 'ti-announcement', 'description' => esc_html__( "Recent posts", "royal-addons" ), "category" => esc_html__( "Royal", "royal-addons" ), "params" => array( array( "type" => "dropdown", "holder" => "div", "class" => "", "heading" => esc_html__( "Column", "royal-addons" ), "param_name" => "column", "value" => array( "1/2" => '1/2', "1/3" => '1/3', "1/4" => '1/4' ), "std" => "1/4", "description" => "", "admin_label" => true, ), array( "type" => "textfield", "heading" => esc_html__( "Limit", "royal-addons" ), "param_name" => "limit", "value" => "3", "description" => "", "admin_label" => true, ), ) )); } } add_shortcode( 'blog', array( 'Royal_Shortcode_Blog', 'blog' ) ); add_action( 'vc_before_init', array( 'Royal_Shortcode_Blog', 'vc_blog' ) );
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings