Server IP : 104.21.14.103 / Your IP : 52.14.190.74 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/dietcontrungnhanh.com/wp-content/themes/flatsome/inc/shortcodes/ |
Upload File : |
<?php function ux_navigation($atts) { extract(shortcode_atts(array( 'class' => '', 'visibility' => '', 'parent' => '', 'align' => 'left', 'style' => 'line', 'type' => 'vertical', // horizontal / vertical 'size' => '', 'case' => 'uppercase', //'bg_color' => '', //'height' => '', //'sticky' => '', ), $atts)); ob_start(); global $post; $current = get_the_ID($post->ID); $classes = array('nav'); if($class) $classes[] = $class; if($visibility) $classes[] = $visibility; if($case) $classes[] = 'nav-'.$case; if($type) $classes[] = 'nav-'.$type; if($size) $classes[] = 'nav-size-'.$size; if($style) $classes[] = 'nav-'.$style; if($align) $classes[] = 'text-'.$align.' nav-'.$align; echo '<div class="nav-wrapper">'; echo '<ul class="'.implode(' ',$classes).'">'; if ( is_page() && $post->post_parent && !$parent ){ $childpages = get_pages( array( 'child_of' => $post->post_parent, 'sort_column' => 'menu_order' ) ); } else { $post_id = $post->ID; if($parent) { if(!is_numeric($parent)){ $id = get_page_by_path( $parent ); $parent = $id->ID; } $post_id = $parent; } $childpages = get_pages( array( 'child_of' => $post_id, 'sort_column' => 'menu_order' ) ); if(!$childpages) echo '<p class="lead shortcode-error text-center">Sorry, no pages was found</p>'; } foreach ( $childpages as $page ) { $classes = ''; if($page->ID == $current) $classes = 'active'; echo '<li class='.$classes.'><a href="'.get_the_permalink($page->ID).'">'.$page->post_title.'</a></li>'; } echo '</ul>'; echo '</div>'; $content = ob_get_contents(); ob_end_clean(); return $content; } add_shortcode("ux_nav", "ux_navigation");