PATH:
home
/
niazsaze
/
public_html
/
wp-content
/
themes
/
flatsome
/
inc
/
shortcodes
<?php /** * Registers the `ux_menu_link` shortcode. * * @package flatsome */ /** * Renders the `ux_menu_link` shortcode. * * @param array $atts An array of attributes. * @param string $content The shortcode content. * @param string $tag The name of the shortcode, provided for context to enable filtering. * * @return string */ function flatsome_render_ux_menu_link_shortcode( $atts, $content, $tag ) { global $wp_query; $atts = shortcode_atts( array( 'visibility' => '', 'class' => '', 'text' => '', 'label' => '', 'icon' => '', 'post' => '', 'term' => '', 'link' => '', 'target' => '_self', 'rel' => '', ), $atts, $tag ); $object = null; $object_id = null; $object_type = null; $queried_object = $wp_query->get_queried_object(); $queried_object_id = (int) $wp_query->queried_object_id; $classes = array( 'ux-menu-link flex menu-item' ); $link = trim( $atts['link'] ); $icon = $atts['icon'] ? get_flatsome_icon( 'ux-menu-link__icon text-center ' . $atts['icon'] ) : ''; if ( ! empty( $atts['post'] ) ) { $object_type = 'post_type'; $object_id = (int) $atts['post']; $object = get_post( $object_id ); $link = get_permalink( $object_id ); } elseif ( ! empty( $atts['term'] ) ) { $object_type = 'taxonomy'; $object_id = (int) $atts['term']; $object = get_term_by( 'term_taxonomy_id', $object_id ); $link = get_term_link( $object_id ); } if ( ! is_string( $link ) ) { $link = ''; } $protocols = array_diff( wp_allowed_protocols(), array( 'http', 'https' ) ); $protocol = explode( ':', $link )[0]; $skip_validate_url = substr( $link, 0, 1 ) === '#' || in_array( $protocol, $protocols, true ); // Ensure paths (except hash & specific protocols (f.ex: mailto:, sms:, ...) are rendered as full URLs. if ( ! $skip_validate_url && ! wp_http_validate_url( $link ) ) { $link = site_url( $link ); } if ( ! empty( $atts['class'] ) ) $classes[] = $atts['class']; if ( ! empty( $atts['label'] ) ) $classes[] = $atts['label']; if ( ! empty( $atts['visibility'] ) ) $classes[] = $atts['visibility']; if ( $object && $queried_object && $queried_object_id === $object_id && ( ( $object_type === 'post_type' && $wp_query->is_singular ) || ( $object_type === 'taxonomy' && $queried_object->taxonomy === $object->taxonomy ) ) ) { $classes[] = 'ux-menu-link--active'; } $link_rels = explode( ' ', $atts['rel'] ); $link_atts = array( 'target' => $atts['target'], 'rel' => array_filter( $link_rels ), ); ob_start(); ?> <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> <a class="ux-menu-link__link flex" href="<?php echo esc_url( $link ); ?>" <?php echo flatsome_parse_target_rel( $link_atts, true ); ?>> <?php echo $icon; ?> <span class="ux-menu-link__text"> <?php echo esc_html( $atts['text'] ); ?> </span> </a> </div> <?php return ob_get_clean(); } add_shortcode( 'ux_menu_link', 'flatsome_render_ux_menu_link_shortcode' );
[-] ux_video.php
[edit]
[-] ux_stack.php
[edit]
[-] gap.php
[edit]
[-] ux_payment_icons.php
[edit]
[-] row.php
[edit]
[-] page_header.php
[edit]
[-] ux_slider.php
[edit]
[-] buttons.php
[edit]
[-] scroll_to.php
[edit]
[-] product_flip.php
[edit]
[-] messages.php
[edit]
[-] ux_banner_grid.php
[edit]
[-] tabs.php
[edit]
[-] ux_translation.php
[edit]
[-] ux_banner.php
[edit]
[-] price_table.php
[edit]
[-] ux_products.php
[edit]
[-] ux_html.php
[edit]
[-] ux_pages.php
[edit]
[-] ux_menu_title.php
[edit]
[-] search.php
[edit]
[-] custom-product.php
[edit]
[-] ux_products_list.php
[edit]
[-] ux_lottie.php
[edit]
[-] accordion.php
[edit]
[+]
ux_countdown
[-] featured_box.php
[edit]
[-] titles_dividers.php
[edit]
[-] ux_instagram_feed.php
[edit]
[-] ux_image.php
[edit]
[-] ux_menu_link.php
[edit]
[-] ux_gallery.php
[edit]
[-] google_maps.php
[edit]
[-] ux_sidebar.php
[edit]
[-] portfolio.php
[edit]
[-] product_categories.php
[edit]
[-] follow.php
[edit]
[-] lightbox.php
[edit]
[-] team_members.php
[edit]
[-] testimonials.php
[edit]
[-] blog_posts.php
[edit]
[-] ux_image_box.php
[edit]
[-] ux_logo.php
[edit]
[-] ux_text.php
[edit]
[-] sections.php
[edit]
[-] share.php
[edit]
[-] ux_hotspot.php
[edit]
[+]
..
[-] ux_menu.php
[edit]
[-] ux_nav.php
[edit]
[+]
commons
[-] text_box.php
[edit]