WordPress Template files (Understrap)
Blog Post : single.php Blog List: index.php loop-templates/content.php
Blog Post : single.php Blog List: index.php loop-templates/content.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
wp_reset_query(); // get_posts in same custom taxonomy $postlist_args = array( 'posts_per_page' => -1, 'orderby' => 'menu_order', 'post_type' => 'etudes_de_cas' ); $postlist = get_posts( $postlist_args ); // get ids of posts retrieved from get_posts $ids = array(); foreach ($postlist as $thepost) { $ids[] = $thepost->ID; } // get and echo previous and next post in the same taxonomy $thisindex = array_search($post->ID, $ids); $previd = $ids[$thisindex-1]; $nextid = $ids[$thisindex+1]; if ( empty($previd) ) { $lastPos = count($ids); $previd = $ids[$lastPos-1]; } if ( empty($nextid) ) { $nextid = $ids[0]; } |
1 2 3 4 5 6 7 8 9 10 11 |
/** FORM RESPONSE **/ div.wpcf7-validation-errors { border: 2px solid #f7e700; background-color: #f7e700; color: #000000; } div.wpcf7-mail-sent-ok { border: 2px solid #398f14; background-color: #398f14; color: #ffffff; } |
functions.php
1 2 3 4 5 6 7 8 9 |
// ADDONS ULTIMATES VC ON EVERY PAGES add_action( 'wp_enqueue_scripts', 'add_theme_stylesheet' ); function add_theme_stylesheet() { // register js wp_enqueue_script('ultimate-script',plugins_url('Ultimate_VC_Addons/assets/min-js/ultimate.min.js')); // register css wp_enqueue_style('ultimate-style-min',plugins_url('Ultimate_VC_Addons/assets/min-css/ultimate.min.css')); } |
1 2 3 4 5 |
Previous Post URL <?php echo get_permalink( get_adjacent_post( false, '', true ) ); ?> Next Post URL <?php echo get_permalink( get_adjacent_post( false, '', false ) ); ?> |
1 2 3 4 5 6 |
//CSS wp_enqueue_style( "style", "/wp-content/themes/saturnthemes-financebank-child/assets/css/jquery.tabSlideOut.css" ); //JAVASCRIPT wp_enqueue_script( "jquery.tabSlideOut", "/wp-content/themes/saturnthemes-financebank-child/assets/js/jquery.tabSlideOut.js", array( "jquery" ), '1.0.0', true ); wp_enqueue_script( "custom", "/wp-content/themes/saturnthemes-financebank-child/assets/js/custom.js", array( "jquery" ), '1.0.0', true ); |
1 2 3 4 5 6 7 8 9 10 |
// Create links to other language function icl_post_languages(){ $languages = icl_get_languages('skip_missing=1'); if(1 < count($languages)){ foreach($languages as $l){ if(!$l['active']) $langs[] = '<a href="'.$l['url'].'">'.$l['native_name'].'</a>'; } echo join(', ', $langs); } } |
1 2 |
// Call functions by php <!--?php icl_post_languages(); ?--> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
//CREATE CUSTOM DYNAMIC MENU // DEFINE POSITION OF THE ADDING MENU ITEMS add_filter('wp_nav_menu_items', 'new_nav_menu_items', 10, 2); function new_nav_menu_items($items, $args) { if( ($args->theme_location == 'primary-menu')){ $items_array = array(); while ( false !== ( $item_pos = strpos ( $items, '<li', 1 ) ) ){ $items_array[] = substr($items, 0, $item_pos); $items = substr($items, $item_pos); } $items_array[] = $items; $add_menu_item = '<ul class="sub-menu">'; $terms = get_terms('event-category'); foreach ( $terms as $term ) { //echo $term->name.'<br />'; $add_menu_item .= '<li class="menu-item"><a href="'.get_site_url().'/programmation/?_sft_event-category='.$term->slug.'" class="menu-item-link">'.$term->name.'</a></li>'; } $add_menu_item .= '</ul>'; array_splice($items_array, 2, 0, $add_menu_item); $items = implode('', $items_array); } return $items; } |
1 2 3 4 5 |
<?php if(ICL_LANGUAGE_CODE=='en'){ ?> <?php }else if(ICL_LANGUAGE_CODE=='fr'){ ?> <?php } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
//global $wp_query; $today = date("Y-m-d"); $args_widget = array( 'post_type' => 'tribe_events', 'eventDisplay' => 'all', 'meta_query' => array( array( 'key' => '_EventEndDate', 'value' => $today, 'compare' => '>=', ) ), 'tax_query' => array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => 'activites-permanentes', ) ), 'orderby' => 'rand', 'posts_per_page' => -1 ); $loop_widget = new WP_Query($args_widget); echo' <div class="tribe-mini-calendar-wrapper"> <div class="tribe-mini-calendar-list-wrapper"> <div class="tribe-events-loop hfeed vcalendar">'; while ( $loop_widget->have_posts() ) : $loop_widget->the_post(); endwhile;</div> </div> </div> |