File manager - Edit - /home/carfac/public_html/rephotonet/wordpress/wp-content/plugins/royal-addons/shortcodes/portfolio.php
Back
<?php // Portfolio ([portfolio]) class Royal_Shortcode_Portfolio { public static function portfolio( $atts, $content = null ) { extract( shortcode_atts( array( 'order' => 'menu_order', 'filters' => 'true', 'limit' => -1, 'terms' => '', 'size_large' => 5, 'size_medium' => 5, 'size_small' => 4, 'size_extra_small' => 2 ), $atts ) ); $filters_html = ''; $limit = intval( $limit ); if ( $filters == 'true' ) { $categories = get_terms(array( 'taxonomy' => 'portfolio-category', 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => true )); if ( count( $categories ) > 0 ) { $filters_html = '<a href="#" data-filter="*" class="active">' . esc_html__( 'All', 'royal' ) . '</a>'; foreach ( $categories as $row ) { $filters_html .= '<a href="#" data-filter=".filter-' . esc_attr( $row->slug ) . '">' . esc_html( $row->name ) . '</a>'; } } } $query = array( 'post_type' => 'portfolio', 'suppress_filters' => 0, 'numberposts' => $limit, 'order' => ( ( $order == 'date' or $order == 'modified' or $order == 'rand' ) ? 'DESC' : 'ASC' ), 'orderby' => $order ); if ( ! empty( $terms ) ) { $terms_arr = explode( ',', $terms ); $terms_query = array( ); if ( is_array( $terms_arr ) and count( $terms_arr ) > 0 ) { foreach ( $terms_arr as $term ) { $terms_query[] = trim( esc_sql( $term ) ); } $query['tax_query'] = array( array( 'taxonomy' => 'portfolio-category', 'field' => 'slug', 'terms' => $terms_query ) ); } } $rows = get_posts( $query ); $output = $projects = ''; if ( count( $rows ) > 0 ) { foreach ( $rows as $row ) { $info = wp_get_object_terms( $row->ID, 'portfolio-category' ); $category = array( ); $filter = ''; foreach( $info as $item ) { $category[] = $item->name; $filter .= 'filter-' . $item->slug . ' '; } $category = implode( ', ', $category ); $filter = rtrim( $filter ); unset( $info ); $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $row->ID ), 'full' ); $title = get_the_title( $row ); $link = get_permalink( $row->ID ); if ( get_option( 'show_on_front', 'posts' ) == 'page' and get_option( 'page_on_front', 0 ) > 0 and Royal_Theme::royal_is_front_page( get_the_ID( ) ) ) { $href = site_url( '#view-' . $row->post_name ); } else { $href = $link; } $projects .= ' <div> <div class="portfolio-item' . ( ! empty( $filter ) ? ' ' . esc_attr( $filter ) : '' ) . '" rel="' . esc_attr( $row->post_name ) . '"> <img src="' . $thumb[0] . '" alt="' . esc_attr( $title ) . '"> <div class="overlay"></div> <div class="details">' . esc_html( $title ) . '</div> <div class="href"> <a href="' . esc_url( $href ) . '" data-url="' . esc_url( $link ) . '"></a> </div> </div> </div>'; } if ( $filters == 'true' and ! empty( $filters_html ) ) { $output = '<div class="row text-center offsetTop"><div class="col-md-12 portfolio-filters">' . $filters_html . '</div></div>'; } $output .= '</div></div></div></div></div><div class="container-fluid offsetTop' . ( ( $filters == 'true' and ! empty( $filters_html ) ) ? '' : 'S' ) . '"><div class="row portfolio-items clearfix" data-on-line-lg="' . $size_large . '" data-on-line-md="' . $size_medium . '" data-on-line-sm="' . $size_small . '" data-on-line-xs="' . $size_extra_small . '">' . $projects . '</div>'; } return $output; } public static function vc_portfolio() { vc_map( array( "name" => esc_html__( "Portfolio", "royal-addons" ), "base" => "portfolio", "icon" => 'ti-briefcase', "description" => esc_html__( "Recent projects", "royal-addons" ), "category" => esc_html__( "Royal", "royal-addons" ), "params" => array( array( "group" => "General", "type" => "dropdown", "holder" => "div", "class" => "", "heading" => esc_html__( "Order By", "royal-addons" ), "param_name" => "order", "value" => array( "Default" => 'menu_order', "ID" => 'id', "Title" => 'title', "Date" => 'date', "Modified" => 'modified', "Random" => 'rand' ), "std" => "menu_order", "description" => "", "admin_label" => true, ), array( "group" => "General", "type" => "checkbox", "heading" => esc_html__( "Filters", "royal-addons" ), "param_name" => "filters", "value" => "", "std" => "true", "description" => "", "admin_label" => true, ), array( "group" => "General", "type" => "textfield", "heading" => esc_html__( "Limit", "royal-addons" ), "param_name" => "limit", "value" => "-1", "description" => "", "admin_label" => true, ), array( "group" => "General", "type" => "textfield", "heading" => esc_html__( "Terms", "royal-addons" ), "param_name" => "terms", "value" => "", "description" => "", "admin_label" => true, ), array( "group" => "Column Size", "type" => "textfield", "heading" => esc_html__( "Desktop", "royal-addons" ), "param_name" => "size_large", "value" => "5", "description" => "", "admin_label" => true, ), array( "group" => "Column Size", "type" => "textfield", "heading" => esc_html__( "Laptop", "royal-addons" ), "param_name" => "size_medium", "value" => "5", "description" => "", "admin_label" => true, ), array( "group" => "Column Size", "type" => "textfield", "heading" => esc_html__( "Tablet", "royal-addons" ), "param_name" => "size_small", "value" => "4", "description" => "", "admin_label" => true, ), array( "group" => "Column Size", "type" => "textfield", "heading" => esc_html__( "Phone", "royal-addons" ), "param_name" => "size_extra_small", "value" => "2", "description" => "", "admin_label" => true, ), ) )); } // Portfolio project details + share ([details]) public static function details( $atts, $content = null ) { extract( shortcode_atts( array( 'share' => 'yes' ), $atts ) ); $panel = ' <div class="share-panel"> <span>' . esc_html__( 'Share', 'royal' ) . '</span> <div class="social"> <a title="Twitter" onclick="shareTo( \'twitter\', \'#share-title\', \'#share-image\', \'#view-\' + jQuery( \'#portfolio-details\' ).attr( \'data-current\' ) )"><i class="fab fa-twitter"></i></a> <a title="Facebook" onclick="shareTo( \'facebook\', \'#share-title\', \'#share-image\', \'#view-\' + jQuery( \'#portfolio-details\' ).attr( \'data-current\' ) )"><i class="fab fa-facebook-f"></i></a> <a title="Pinterest" onclick="shareTo( \'pinterest\', \'#share-title\', \'#share-image\', \'#view-\' + jQuery( \'#portfolio-details\' ).attr( \'data-current\' ) )"><i class="fab fa-pinterest"></i></a> <a title="LinkedIn" onclick="shareTo( \'linkedin\', \'#share-title\', \'#share-image\', \'#view-\' + jQuery( \'#portfolio-details\' ).attr( \'data-current\' ) )"><i class="fab fa-linkedin-in"></i></a> </div> </div>'; $content = preg_replace( '/<ul/', '<ul class="fa-ul details"', $content ); $content = preg_replace( '/<li>/', '<li><i class="fa-li fas fa-angle-right colored"></i> ', $content ); return do_shortcode( $content ) . ( $share == 'yes' ? $panel : '' ); } public static function vc_details() { vc_map( array( "name" => esc_html__( "Project Details", "royal-addons" ), "base" => "details", "icon" => 'ti-book', "description" => esc_html__( "Item info", "royal-addons" ), "category" => esc_html__( "Royal", "royal-addons" ), "params" => array( array( "type" => "textarea_html", "heading" => esc_html__( "Text", "royal-addons" ), "param_name" => "content", "value" => "", "description" => "", "admin_label" => true, ), array( "type" => "dropdown", "holder" => "div", "class" => "", "heading" => esc_html__( "Share", "royal-addons" ), "param_name" => "share", "value" => array( esc_html__( "Yes", "royal-addons" ) => 'yes', esc_html__( "No", "royal-addons" ) => 'no' ), "std" => "yes", "description" => "", "admin_label" => true, ), ) )); } } add_shortcode( 'portfolio', array( 'Royal_Shortcode_Portfolio', 'portfolio' ) ); add_shortcode( 'details', array( 'Royal_Shortcode_Portfolio', 'details' ) ); add_action( 'vc_before_init', array( 'Royal_Shortcode_Portfolio', 'vc_portfolio' ) ); add_action( 'vc_before_init', array( 'Royal_Shortcode_Portfolio', 'vc_details' ) );
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0.41 |
proxy
|
phpinfo
|
Settings