function wm_shortcode_testimonials( $atts, $content = null ) { extract( shortcode_atts( array( 'category' => null, 'count' => 5, 'layout' => 'normal', 'order' => 'new', 'private' => false, 'speed' => 0, 'stack' => 1, 'testimonial' => null, ), $atts ) ); if ( wm_option( 'blog-no-format-quote' ) || ! ( $category || $testimonial ) ) return; $out = ''; $count = absint( $count ); $speed = ( 1 < absint( $speed ) ) ? ( ' data-time="' . absint( $speed ) * 1000 . '"' ) : ( false ); $layout = ( 'large' == trim( $layout ) ) ? ( ' large' ) : ( ' normal' ); $orderMethod = array( 'all' => array( 'new', 'old', 'random' ), 'new' => array( 'date', 'DESC' ), 'old' => array( 'date', 'ASC' ), 'random' => array( 'rand', '' ) ); $order = ( in_array( trim( $order ), $orderMethod['all'] ) ) ? ( $orderMethod[trim( $order )] ) : ( $orderMethod['new'] ); $private = ( ! $private ) ? ( 'publish' ) : ( array( 'publish', 'private' ) ); $stack = absint( $stack ); if ( $category ) if ( is_numeric( $category ) ) { $category = absint( $category ); } else { $category = get_term_by( 'slug', sanitize_title( $category ), 'category' ); $category = ( $category && isset( $category->term_id ) ) ? ( $category->term_id ) : ( null ); } else $category = null; //get the testimonials wp_reset_query(); if ( ! $testimonial ) { $queryArgs = array( 'post_status' => $private, 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'cat' => $category, 'orderby' => $order[0], 'order' => $order[1], 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-quote', ) ) ); } else { $speed = false; $postQuery = ( is_numeric( trim( $testimonial ) ) ) ? ( 'p' ) : ( 'name' ); $queryArgs = array( 'post_status' => $private, $postQuery => $testimonial, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-quote', ) ) ); } $testimonials = new WP_Query( $queryArgs ); if ( $testimonials->have_posts() ) { $i = 0; $out .= '<div class="wrap-testimonials-shortcode apply-top-margin' . $layout . '"' . $speed . '><div class="testimonials-list">'; $articleOpened = false; while ( $testimonials->have_posts() ) : $i++; $testimonials->the_post(); if ( 1 == $stack || 1 == $i || 1 == $i % $stack ) { $out .= '<article class="testimonial testimonial-' . get_the_ID() . ' item-' . $i . '">'; $articleOpened = true; } $out .= '<div class="testimonial-container">'; $quote = get_the_content(); $quote = preg_replace( '/<(\/?)blockquote(.*?)>/', '', $quote ); //remove <blockquote> tags $quote = explode( '<cite', $quote ); //split where <cite> tag begins $out .= '<blockquote>' . apply_filters( 'wm_default_content_filters', $quote[0] ) . '</blockquote>'; $quoteSource = ''; if ( has_post_thumbnail() ) { $imgUrl = wp_get_attachment_image_src( get_post_thumbnail_id(), 'widget' ); $escImgAlt = esc_attr( strip_tags( strip_shortcodes( wm_meta_option( 'quoted-author' ) ) ) ); $quoteSource .= '<span class="testimonial-source-img frame"><img src="' . $imgUrl[0] . '" alt="' . $escImgAlt . '" title="' . $escImgAlt . '" /></span>'; } if ( isset( $quote[1] ) && $quote[1] ) $quoteSource .= '<cite' . $quote[1]; if ( $quoteSource ) $out .= '<p class="testimonial-source">' . $quoteSource . '</p>'; $out .= '</div>'; if ( 1 == $stack || $count == $i || 0 == $i % $stack ) { $out .= '</article>'; $articleOpened = false; } endwhile; if ( $articleOpened ) $out .= '</article>'; $out .= '</div></div>'; } wp_reset_query(); if ( $speed ) wp_enqueue_script( 'bxslider' ); //output return do_shortcode( $out ); }
function wm_search_filter( $query ) { if ( $query->is_search ) { $removePages = array(); $pages = get_pages(); foreach ( $pages as $page ) { if ( wm_meta_option( 'restrict-access', $page->ID ) ) $removePages[] = $page->ID; } $query->set( 'post__not_in', $removePages ); } return $query; }
get_template_part( 'inc/loop/loop', 'project-post' ); else get_template_part( 'inc/loop/loop', 'project' ); ?> <?php //next/previous project links $out = ''; $out .= ( be_get_previous_post( true, '', 'project-category' ) ) ? ( '<a href="' . get_permalink( be_get_previous_post( true, '', 'project-category' )->ID ) . '" title="' . sprintf( __( 'Previous project (%s)', 'lespaul_domain' ), esc_attr( strip_tags( get_the_title( be_get_previous_post( true, '', 'project-category' )->ID ) ) ) ) . '" class="prev"><i class="wmicon-left-circle"></i> ' . trim( get_the_title( be_get_previous_post( true, '', 'project-category' )->ID ) ) . '</a>' ) : ( null ); $out .= ( be_get_next_post( true, '', 'project-category' ) ) ? ( '<a href="' . get_permalink( be_get_next_post( true, '', 'project-category' )->ID ) . '" title="' . sprintf( __( 'Next project (%s)', 'lespaul_domain' ), esc_attr( strip_tags( get_the_title( be_get_next_post( true, '', 'project-category' )->ID ) ) ) ) . '" class="next">' . trim( get_the_title( be_get_next_post( true, '', 'project-category' )->ID ) ) . ' <i class="wmicon-right-circle"></i></a>' ) : ( null ); if ( $out ) echo '<footer class="meta-project">' . $out . '</footer>'; //Related projects if ( ! wm_option( 'contents-no-related-projects' ) && ! wm_meta_option( 'project-no-related' ) ) { $columns = ( ! wm_meta_option( 'layout' ) || 'none' === wm_meta_option( 'layout' ) ) ? ( 4 ) : ( 3 ); $title = ( wm_option( 'contents-related-projects-title' ) ) ? ( strip_tags( wm_option( 'contents-related-projects-title' ) ) ) : ( __( 'Related projects', 'lespaul_domain' ) ); echo do_shortcode( '[projects related="' . $title . '" columns="' . $columns . '" count="' . $columns . '" order="random" thumb="1" /]' ); } ?> </article> <!-- /main --> <?php if ( 'none' != $sidebarLayout ) { $class = 'sidebar clearfix sidebar-' . $sidebarLayout . $sidebarPanes[0]; wm_sidebar( $overrideSidebar, $class ); } ?>
function wm_price_cp_custom_column( $wm_priceCol ) { global $post; $prefix = 'wm_price-'; $prefixMeta = 'price-'; switch ( $wm_priceCol ) { case $prefix . "cost": echo '<span style="font-size: 1.4em">' . stripslashes( wm_meta_option( $prefixMeta . 'cost' ) ) . '</span>'; break; case $prefix . "featured": $wm_priceFeatured = ( ' featured' === wm_meta_option( $prefixMeta . 'style' ) ) ? ( '<span style="font-size:1.5em">✓</span>' ) : ( '' ); echo $wm_priceFeatured; break; case $prefix . "color": $color = ( wm_meta_option( $prefixMeta . 'color' ) ) ? ( wm_meta_option( $prefixMeta . 'color', $post->ID, 'color' ) ) : ( '#eee' ); edit_post_link( '<span class="color-display" style="background-color:' . $color . ';"></span>' ); break; case $prefix . "table": $terms = get_the_terms( $post->ID , 'price-table' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $termName = ( isset( $term->name ) ) ? ( $term->name ) : ( null ); echo '<strong>' . $termName . '</strong><br />'; } } break; case $prefix . "order": if ( absint( wm_meta_option( $prefixMeta . 'order' ) ) ) echo absint( wm_meta_option( $prefixMeta . 'order' ) ); break; default: break; } }
$pageId = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null ); if ( is_page_template( 'page-template/landing.php' ) ) { $aboveFooter = wm_meta_option( 'landing-above-footer-widgets' ); $footerRow = wm_meta_option( 'landing-footer-widgets' ); } if ( is_page_template( 'page-template/construction.php' ) ) $aboveFooter = $footerRow = null; if ( is_404() && wm_option( 'p404-no-above-footer-widgets' ) ) $aboveFooter = null; //WooCommerce pages if ( class_exists( 'Woocommerce' ) && is_woocommerce() ) $aboveFooter = null; if ( $aboveFooter && is_active_sidebar( $aboveFooter ) && ! wm_meta_option( 'no-above-footer-widgets', $pageId ) ) { echo '<section id="above-footer" class="wrap clearfix above-footer-widgets-wrap' . wm_element_width( 'abovefooter' ) . '"><div class="wrap-inner">'; wm_sidebar( $aboveFooter, 'widgets columns twelve pane', 5 ); //no restriction echo '</div></section>'; } ?> <?php do_action( 'wm_before_footer' ); ?> <footer id="footer" class="wrap clearfix footer<?php echo wm_element_width( 'footer' ); ?>"> <!-- FOOTER --> <?php if ( $footerRow && is_active_sidebar( $footerRow ) ) { echo '<section class="footer-widgets-wrap first"><div class="wrap-inner">'; wm_sidebar( $footerRow, 'widgets columns twelve pane', 5 ); //restricted to 5 widgets echo '</div></section>';
$out .= '<a href="' . get_permalink() . '">'; $out .= wp_get_attachment_image( $image, $imageSize ); $out .= '</a>'; } } if ( $out ) { wp_enqueue_script( 'bxslider' ); //check whether this could be just like this or it needs a shortcode? echo '<div class="simple-slider" data-time="4000">' . $out . '</div>'; } } else { //no gallery? -> display featured image if ( is_single() && ! wm_option( 'blog-disable-featured-image' ) && ! wm_meta_option( 'disable-featured-image' ) ) echo wm_thumb( array( 'size' => 'content-width' ) ); elseif ( ! is_single() ) echo wm_thumb( array( 'size' => $imageSize ) ); } ?> </div> <div <?php post_class( 'article-content' ); ?>> <?php if ( ! is_single() ) wm_heading( 'list' ); ?>
<?php if ( ! in_array( wm_option( 'header-navigation-position' ), array( ' nav-right', ' nav-left', ' nav-bottom logo-centered' ) ) || is_page_template( 'page-template/construction.php' ) || ( is_page_template( 'page-template/landing.php' ) && ! has_nav_menu( 'menu-landing-page-' . get_the_ID() ) ) ) { //Header right area (display only when rich (normal) header layout used) $headerText = wm_option( 'header-right' ); $headerText = ( ' ' == $headerText ) ? ( '' ) : ( $headerText ); if ( is_page_template( 'page-template/landing.php' ) ) $headerText = wm_meta_option( 'landing-header-right' ); if ( is_page_template( 'page-template/construction.php' ) ) $headerText = wm_meta_option( 'construction-header-right' ); $replaceArray = array( '(r)' => '®', '(R)' => '®', '(tm)' => '™', '(TM)' => '™', 'YEAR' => date( 'Y' ), 'SEARCH' => get_search_form( false ) ); $headerText = strtr( $headerText, $replaceArray ); if ( $headerText ) echo '<div class="header-side"><a class="invisible" href="#nav-main">' . __( 'Go to main navigation', 'lespaul_domain' ) . '</a><div class="header-side-content">' . apply_filters( 'wm_default_content_filters', $headerText ) . '</div></div>';
function wm_form_datepicker( $value, $isMeta = null ) { if ( 'meta' == $isMeta ) $val = wm_meta_option( $value['id'] ); else $val = wm_option( $value['id'] ); $valId = WM_THEME_SETTINGS_PREFIX . $value['id']; $default = ( isset( $value['default'] ) ) ? ( intval( $value['default'] ) ) : ( null ); $class = ( isset( $value['class'] ) && $value['class'] ) ? ( ' class="' . $value['class'] . '"' ) : ( null ); $setValue = ( $val ) ? ( $val ) : ( $default ); ?> <div class="option" data-option="<?php echo $valId; ?>"> <p> <?php if ( $default ) echo '<a data-default="' . $valId . '" class="btn btn-default" title="' . __( 'Use default value', 'lespaul_domain_adm' ) . '">' . __( 'Default value', 'lespaul_domain_adm' ) . '<span>' . $default . '</span></a>'; ?> <label for="<?php echo $valId; ?>"><?php echo strip_tags( $value['label'] ); ?></label> </p> <?php if ( isset( $value['desc'] ) && $value['desc'] ) echo '<p class="desc">' . $value['desc'] . '</p>'; ?> <p> <input type="text" data-type="date" name="<?php echo $valId; ?>" id="<?php echo $valId; ?>" value="<?php echo esc_attr( $setValue ); ?>"<?php echo $class; ?> /> </p> </div> <!-- /option --> <?php wm_conditional_show( $value, $valId ); }
$out = '<li class="staff-name" title="' . __( 'Name', 'lespaul_domain_adm' ) . '"><strong>' . get_the_title() . '</strong>'; if ( wm_meta_option( 'staff-position' ) ) $out .= '<br /><span class="staff-position">' . wm_meta_option( 'staff-position' ) . '</span>'; if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) $out .= '<br /><span class="staff-department">' . $terms . '</span>'; $out .= '</li>'; if ( wm_meta_option( 'staff-phone' ) ) $out .= '<li class="staff-phone" title="' . __( 'Phone', 'lespaul_domain_adm' ) . '"><strong>' . __( 'Phone', 'lespaul_domain_adm' ) . ': </strong>' . wm_meta_option( 'staff-phone' ) . '</li>'; if ( wm_meta_option( 'staff-email' ) ) $out .= '<li class="staff-email" title="' . __( 'Email', 'lespaul_domain_adm' ) . '"><strong>' . __( 'Email', 'lespaul_domain_adm' ) . ': </strong><a href="#" data-address="' . wm_nospam( wm_meta_option( 'staff-email' ) ) . '" class="email-nospam">' . wm_nospam( wm_meta_option( 'staff-email' ) ) . '</a></li>'; if ( wm_meta_option( 'staff-linkedin' ) ) $out .= '<li class="staff-linkedin" title="' . __( 'LinkedIn', 'lespaul_domain_adm' ) . '"><strong>' . __( 'LinkedIn', 'lespaul_domain_adm' ) . ': </strong><a href="' . esc_url( wm_meta_option( 'staff-linkedin' ) ) . '" target="_blank">' . get_the_title() . '</a></li>'; if ( wm_meta_option( 'staff-skype' ) ) $out .= '<li class="staff-skype" title="' . __( 'Skype', 'lespaul_domain_adm' ) . '"><strong>' . __( 'Skype', 'lespaul_domain_adm' ) . ': </strong><a href="skype:' . sanitize_title( wm_meta_option( 'staff-skype' ) ) . '?call">' . wm_meta_option( 'staff-skype' ) . '</a></li>'; if ( is_array( wm_meta_option( 'staff-custom-contacts' ) ) ) { foreach ( wm_meta_option( 'staff-custom-contacts' ) as $contact ) { $out .= '<li class="' . $contact['attr'] . '">' . strip_tags( trim( $contact['val'] ), '<a><img><strong><span><small><em><b><i>' ) . '</li>'; } } if ( $out ) echo '<div class="staff-card alignleft">' . wm_thumb( array( 'size' => 'mobile' ) ) . '<ul>' . $out . '</ul></div>'; ?> <?php if ( is_single() ) { the_content(); } else { wm_content_or_excerpt( $post ); } ?>
function wm_projects_cp_custom_column( $wm_projectsCol ) { global $post; $prefix = 'wm_projects-'; $prefixMeta = 'project-'; switch ( $wm_projectsCol ) { case $prefix . "type": break; case $prefix . "category": $terms = get_the_terms( $post->ID , 'project-category' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $termName = ( isset( $term->name ) ) ? ( $term->name ) : ( null ); echo '<strong>' . $termName . '</strong><br />'; } } break; case $prefix . "tag": $separator = ''; $terms = get_the_terms( $post->ID , 'project-tag' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $termName = ( isset( $term->name ) ) ? ( $term->name ) : ( null ); echo $separator . $termName; $separator = ', '; } } break; case $prefix . "thumb": $icon = ''; $projectIcons = array(); $terms = get_terms( 'project-type', 'orderby=name&hide_empty=0&hierarchical=0' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $meta = get_option( 'wm-tax_project-type-' . $term->term_id ); $projectIcons[$meta['type'] . '[' . $term->slug . ']'] = $meta['icon']; } } if ( empty( $projectIcons ) ) $projectIcons = array( 'static-project' => 'wmicon-image', 'slider-project' => 'wmicon-gallery', 'video-project' => 'wmicon-video', 'audio-project' => 'wmicon-audio', ); $icon = ( ! wm_meta_option( $prefixMeta . 'type' ) || ! isset( $projectIcons[wm_meta_option( $prefixMeta . 'type' )] ) ) ? ( '<i class="icon wmicon-image"></i>' ) : ( '<i class="icon ' . $projectIcons[wm_meta_option( $prefixMeta . 'type' )] . '"></i>' ); $size = explode( 'x', WM_ADMIN_LIST_THUMB ); $image = ( has_post_thumbnail() ) ? ( get_the_post_thumbnail( null, 'widget' ) ) : ( '' ); $hasThumb = ( $image ) ? ( ' has-thumb' ) : ( ' no-thumb' ); echo $icon . '<span class="wm-image-container' . $hasThumb . '">'; if ( get_edit_post_link() ) edit_post_link( $image ); else echo '<a href="' . get_permalink() . '">' . $image . '</a>'; echo '</span>'; break; case $prefix . "link": $wm_projectsLink = esc_url( stripslashes( wm_meta_option( $prefixMeta . 'link' ) ) ); echo '<a href="' . $wm_projectsLink . '" target="_blank">' . $wm_projectsLink . '</a>'; break; case $prefix . "layout": $layout = ( 'plain' === wm_meta_option( $prefixMeta . 'single-layout' ) ) ? ( __( 'Post', 'lespaul_domain_adm' ) ) : ( __( 'Project', 'lespaul_domain_adm' ) ); edit_post_link( $layout ); break; default: break; } }
function wm_logos_cp_custom_column( $wm_logosCol ) { global $post; $prefix = 'wm_logos-'; $prefixMeta = 'client-'; switch ( $wm_logosCol ) { case $prefix . "thumb": $size = explode( 'x', WM_ADMIN_LIST_THUMB ); //$image = ( has_post_thumbnail() ) ? ( get_the_post_thumbnail( null, 'widget' ) ) : ( '<img src="' . WM_ASSETS_ADMIN . 'img/no-thumb.png" alt="' . __( 'No image', 'lespaul_domain_adm' ) . '" title="' . __( 'No image', 'lespaul_domain_adm' ) . '" />' ); $image = ( wm_meta_option( $prefixMeta . 'logo' ) ) ? ( '<img src="' . esc_url( wm_meta_option( $prefixMeta . 'logo' ) ) . '" alt="" />' ) : ( '' ); $hasThumb = ( $image ) ? ( ' has-thumb' ) : ( ' no-thumb' ); echo '<span class="wm-image-container' . $hasThumb . '">'; if ( get_edit_post_link() ) edit_post_link( $image ); else echo '<a href="' . get_permalink() . '">' . $image . '</a>'; echo '</span>'; break; case $prefix . "category": $terms = get_the_terms( $post->ID , 'logos-category' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $termName = ( isset( $term->name ) ) ? ( $term->name ) : ( null ); echo '<strong>' . $termName . '</strong><br />'; } } break; case $prefix . "link": $wm_logosLink = esc_url( stripslashes( wm_meta_option( $prefixMeta . 'link' ) ) ); echo '<a href="' . $wm_logosLink . '" target="_blank">' . $wm_logosLink . '</a>'; break; default: break; } }
function wm_modules_cp_custom_column( $wm_modulesCol ) { global $post; $prefix = 'wm_modules-'; $prefixMeta = 'module-'; switch ( $wm_modulesCol ) { case $prefix . "thumb": $image = ( ! has_post_thumbnail() ) ? ( '' ) : ( get_the_post_thumbnail( null, 'widget' ) ); $hasThumb = ( $image ) ? ( ' has-thumb' ) : ( ' no-thumb' ); $iconStyles = ''; if ( 'icon' == wm_meta_option( $prefixMeta . 'type' ) && wm_meta_option( $prefixMeta . 'icon-box-color' ) ) { $iconStyles = ' style="background-color: '; $iconStyles .= ( wm_meta_option( $prefixMeta . 'icon-box-color' ) ) ? ( wm_meta_option( $prefixMeta . 'icon-box-color',$post->ID , 'color' ) ) : ( wm_option( 'design-accent-color', 'color' ) ); $iconStyles .= ';"'; } echo '<span class="wm-image-container' . $hasThumb . '"' . $iconStyles . '>'; if ( get_edit_post_link() ) edit_post_link( $image ); else echo '<a href="' . get_permalink() . '">' . $image . '</a>'; echo '</span>'; if ( 'icon' == wm_meta_option( $prefixMeta . 'type' ) ) echo ' <small>' . __( '[Icon module]', 'lespaul_domain_adm' ) . '</small>'; break; case $prefix . "link": $wm_modulesLink = esc_url( stripslashes( wm_meta_option( $prefixMeta . 'link' ) ) ); echo '<a href="' . $wm_modulesLink . '" target="_blank">' . $wm_modulesLink . '</a>'; break; case $prefix . "shortcode": $wm_modulesLink = esc_url( stripslashes( wm_meta_option( $prefixMeta . 'link' ) ) ); echo '<input type="text" onfocus="this.select();" readonly="readonly" style="width:100%" value="[content_module module="' . $post->post_name . '" /]" class="shortcode-in-list-table">'; break; case $prefix . "tag": $terms = get_the_terms( $post->ID , 'content-module-tag' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { foreach ( $terms as $term ) { $termName = ( isset( $term->name ) ) ? ( $term->name ) : ( null ); echo '<strong>' . $termName . '</strong><br />'; } } break; default: break; } }
$out .= preg_replace( '/(width|height)=\"\d*\"\s/', "", get_the_post_thumbnail( get_the_ID(), $imageSize ) ); } if ( $audioURL ) $out .= strip_tags( wp_oembed_get( esc_url( $audioURL ) ), '<iframe>' ); else $out .= '[box color="red" icon="warning"]' . __( 'Please set "Audio URL" option', 'lespaul_domain' ) . '[/box]'; } $projectLayout['media'] = $out; //Output $layout = ( wm_meta_option( 'project-single-layout' ) ) ? ( explode( ',', wm_meta_option( 'project-single-layout' ) ) ) : ( array( 'media', ' col-34', ' col-14 last' ) ); if ( 3 != count( $layout ) ) $layout = array( 'media', ' col-34', ' col-14 last' ); if ( 3 === count( $layout ) ) { $out = ( 'excerpt' == $layout[0] ) ? ( array( 'excerpt', 'media' ) ) : ( array( 'media', 'excerpt' ) ); echo do_shortcode( '<div class="column' . $layout[1] . '">' . $projectLayout[$out[0]] . '</div><div class="column' . $layout[2] . '">' . $projectLayout[$out[1]] . '</div>' . $projectLayout['content'] ); } ?> <?php do_action( 'wm_end_post' ); ?> <?php wp_reset_query(); endif; ?> <?php comments_template( null, true ); ?>
function wm_head_styles( $classes ) { global $post; //variables needed //post ID $postId = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null ); //custom in-header styles $inHeaderStyles = ''; //page background image if ( ( isset( $post ) || is_home() ) && ! is_search() && ! is_archive() && wm_css_background_meta( 'background-' ) ) { $inHeaderStyles .= ( wm_meta_option( 'background-bg-img-fit-window', $postId ) ) ? ( "\t" . 'body {background: none}' . "\r\n" ) : ( "\t" . 'body {background: ' . wm_css_background_meta( 'background-' ) . '}' . "\r\n" ); $inHeaderStyles .= ( ! wm_meta_option( 'background-bg-color', $postId ) ) ? ( '' ) : ( "\t" . 'html {background: none}' . "\r\n" ); } //main heading area background if ( ( isset( $post ) || is_home() ) && ( wm_css_background_meta( 'heading-background-' ) || wm_meta_option( 'heading-background-padding' ) ) ) { $inHeaderStyles .= ( wm_meta_option( 'heading-background-padding' ) ) ? ( "\t" . '.main-heading .twelve.pane {padding-top: ' . absint( wm_meta_option( 'heading-background-padding' ) ) . 'px; padding-bottom: ' . absint( wm_meta_option( 'heading-background-padding' ) ) . 'px;}' . "\r\n" ) : ( '' ); $inHeaderStyles .= ( wm_css_background_meta( 'heading-background-' ) ) ? ( "\t" . '.main-heading {background: ' . wm_css_background_meta( 'heading-background-' ) . '}' . "\r\n" ) : ( '' ); $inHeaderStyles .= ( ! wm_meta_option( 'heading-background-color', $postId ) ) ? ( '' ) : ( "\t" . '.main-heading h1, .main-heading h2, .main-heading i[class^="icon-"] {color: ' . wm_meta_option( 'heading-background-color', $postId, 'color' ) . ';}' . "\r\n" ); } //wrapper padding when fixed header used if ( in_array( 'header-fixed', get_body_class() ) && 0 < wm_option( 'header-height' ) ) $inHeaderStyles .= "\t" . '@media only screen and (min-width: 1020px) { body.header-fixed { padding-top: ' . absint( wm_option( 'header-height' ) ) . 'px; } body.top-bar-enabled.header-fixed { padding-top: ' . absint( wm_option( 'header-height' ) + 50 ) . 'px; } }' . "\r\n"; //output if ( $inHeaderStyles ) $inHeaderStyles = "\r\n<!-- Custom header styles -->\r\n" . '<style type="text/css">' . "\r\n" . $inHeaderStyles . '</style>' . "\r\n"; echo $inHeaderStyles; }
<?php $postId = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null ); $sidebarLayoutDefault = ( wm_option( 'contents-sidebar-position' ) ) ? ( esc_attr( wm_option( 'contents-sidebar-position' ) ) ) : ( WM_SIDEBAR_DEFAULT_POSITION ); $sidebarLayout = ( ( is_home() || is_singular() ) && wm_meta_option( 'layout', $postId ) ) ? ( wm_meta_option( 'layout', $postId ) ) : ( $sidebarLayoutDefault ); $overrideSidebar = ( ( is_home() || is_singular() ) && wm_meta_option( 'sidebar', $postId ) && -1 != wm_meta_option( 'sidebar', $postId ) ) ? ( wm_meta_option( 'sidebar', $postId ) ) : ( WM_SIDEBAR_FALLBACK ); if ( is_active_sidebar( $overrideSidebar ) && 'none' != $sidebarLayout ) { $sidebarPanes = ( wm_option( 'contents-sidebar-width' ) ) ? ( esc_attr( wm_option( 'contents-sidebar-width' ) ) ) : ( WM_SIDEBAR_WIDTH ); $sidebarPanes = ( 2 == count( explode( ';', $sidebarPanes ) ) ) ? ( explode( ';', $sidebarPanes ) ) : ( explode( ';', WM_SIDEBAR_WIDTH ) ); } else { $sidebarPanes = array( '' ); } if ( 'none' != $sidebarLayout ) { $class = 'sidebar clearfix sidebar-' . $sidebarLayout . $sidebarPanes[0]; wm_sidebar( $overrideSidebar, $class ); } ?>
function wm_staff_cp_custom_column( $wm_staffCol ) { global $post; $prefix = 'wm_staff-'; switch ( $wm_staffCol ) { case $prefix . "position": echo '<strong>' . strip_tags( wm_meta_option( 'staff-position' ) ) . '</strong>'; break; case $prefix . "department": $terms = get_the_terms( $post->ID , 'department' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { $out = $separator = ''; foreach ( $terms as $term ) { $out .= $separator . $term->name; $separator = ', '; } echo $out; } break; case $prefix . "thumb": $size = explode( 'x', WM_ADMIN_LIST_THUMB ); $image = ( has_post_thumbnail() ) ? ( get_the_post_thumbnail( null, 'widget' ) ) : ( '' ); $hasThumb = ( $image ) ? ( ' has-thumb' ) : ( ' no-thumb' ); echo '<span class="wm-image-container' . $hasThumb . '">'; if ( get_edit_post_link() ) edit_post_link( $image ); else echo '<a href="' . get_permalink() . '">' . $image . '</a>'; echo '</span>'; break; default: break; } }
<?php global $page, $paged, $blogLayout; $thisPageId = get_the_ID(); $listClasses = $blogLayout = wm_meta_option( 'blog-layout', $thisPageId ); $articleColumn = ( ' masonry-container' === $listClasses ) ? ( wm_meta_option( 'blog-masonry-size', $thisPageId ) ) : ( '' ); $articleCount = wm_meta_option( 'blog-posts-count', $thisPageId ); $catsAction = ( wm_meta_option( 'blog-cats-action', $thisPageId ) ) ? ( wm_meta_option( 'blog-cats-action', $thisPageId ) ) : ( 'category__not_in' ); $cats = ( wm_meta_option( 'blog-cats', $thisPageId ) ) ? ( array_filter( wm_meta_option( 'blog-cats', $thisPageId ) ) ) : ( array() ); if ( 0 < count( $cats ) ) { //category slugs to IDs $catTemp = array(); foreach ( $cats as $cat ) { if ( ! is_numeric( $cat ) ) { $catObj = get_category_by_slug( $cat ); $catTemp[] = ( $catObj && isset( $catObj->term_id ) ) ? ( $catObj->term_id ) : ( null ); } else { $catTemp[] = $cat; } } array_filter( $catTemp ); //remove empty (if any) $cats = $catTemp; //rearange array keys - makes { 1=>1, 3=>2, 5=>3 } into { 1=>1, 2=>2, 3=>3 } //$cats = implode( ',', $cats ); //$cats = explode( ',', $cats ); }
<?php /* Template Name: Redirect */ $redirectPage = wm_meta_option( 'redirect-page' ); $redirectPageID = wm_page_slug_to_id( $redirectPage ); if ( wm_meta_option( 'redirect-link' ) ) $link = esc_url( wm_meta_option( 'redirect-link' ) ); elseif ( $redirectPageID ) $link = get_permalink( $redirectPageID ); else $link = ''; if ( $link ) { wp_redirect( $link, wm_meta_option( 'redirect-status' ) ); exit; } get_header(); ?> <div class="wrap-inner"> <article class="main twelve pane"> <div class="article-content"> <?php echo do_shortcode( '[box color="red" icon="warning"]' . __( 'Please, set the URL first.', 'lespaul_domain' ) . '[/box]' ); ?> </div> </article> <!-- /main -->
<?php wp_reset_query(); global $blogLayout; $blogPageId = get_option( 'page_for_posts' ); $listClasses = $blogLayout = ( is_archive() || is_home() ) ? ( wm_meta_option( 'blog-layout', $blogPageId ) ) : ( '' ); $articleColumn = ( ( is_archive() || is_home() ) && ' masonry-container' === $listClasses ) ? ( wm_meta_option( 'blog-masonry-size', $blogPageId ) ) : ( '' ); if ( have_posts() ) { ?> <?php do_action( 'wm_before_list' ); ?> <section id="list-articles" class="list-articles clearfix<?php echo $listClasses; ?>"> <?php $addClass = ''; $even = ''; while ( have_posts() ) : the_post(); $format = ( get_post_format() ) ? ( get_post_format() ) : ( 'standard' ); $addClass .= ( is_sticky() ) ? ( ' sticky-post' ) : ( '' ); $addClass .= ( $articleColumn ) ? ( ' column col-1' . $articleColumn ) : ( '' ); $classes = ( $even || $addClass ) ? ( ' class="' . $even . $addClass . '"' ) : ( '' ); ?> <article<?php echo $classes; ?>> <?php get_template_part( 'inc/formats/format', $format ); ?>
<?php /* Template Name: Blog */ get_header(); ?> <div class="wrap-inner"> <?php $postId = ( is_home() ) ? ( get_option( 'page_for_posts' ) ) : ( null ); $sidebarLayoutDefault = ( wm_option( 'contents-sidebar-position' ) ) ? ( esc_attr( wm_option( 'contents-sidebar-position' ) ) ) : ( WM_SIDEBAR_DEFAULT_POSITION ); $sidebarLayout = ( wm_meta_option( 'layout', $postId ) ) ? ( wm_meta_option( 'layout', $postId ) ) : ( $sidebarLayoutDefault ); $overrideSidebar = ( wm_meta_option( 'sidebar', $postId ) && -1 != wm_meta_option( 'sidebar', $postId ) ) ? ( wm_meta_option( 'sidebar', $postId ) ) : ( WM_SIDEBAR_FALLBACK ); if ( is_active_sidebar( $overrideSidebar ) && 'none' != $sidebarLayout ) { $sidebarPanes = ( wm_option( 'contents-sidebar-width' ) ) ? ( esc_attr( wm_option( 'contents-sidebar-width' ) ) ) : ( WM_SIDEBAR_WIDTH ); $sidebarPanes = ( 2 == count( explode( ';', $sidebarPanes ) ) ) ? ( explode( ';', $sidebarPanes ) ) : ( explode( ';', WM_SIDEBAR_WIDTH ) ); if ( 'left' == $sidebarLayout ) $sidebarPanes[1] .= ' sidebar-left'; } else { $sidebarPanes = array( '', ' twelve pane' ); } ?> <section class="main clearfix<?php echo $sidebarPanes[1]; ?>"> <?php do_action( 'wm_start_main_content' ); ?> <?php
function wm_admin_post_list_columns_content( $columns, $post_id ) { switch ( $columns ) { case 'wm-thumb': //post/page thumbnail $overlay = ''; if ( wm_meta_option( 'slider-type' ) && 'none' != wm_meta_option( 'slider-type' ) ) { $sliderImg = ( file_exists( WM_ASSETS_ADMIN . 'img/sliders/' . wm_meta_option( 'slider-type' ) . '.png' ) ) ? ( WM_ASSETS_ADMIN . 'img/sliders/' . wm_meta_option( 'slider-type' ) . '.png' ) : ( WM_ASSETS_ADMIN . 'img/sliders/custom.png' ); $overlay = '<span class="overlay"><img src="' . $sliderImg . '" alt="" title="' . sprintf( __( 'Page with %s slider', 'lespaul_domain_adm' ), ucfirst( wm_meta_option( 'slider-type' ) ) ) . '" /></span>'; } $imageTitle = ( has_post_format( 'status' ) ) ? ( __( 'Status text: ', 'lespaul_domain_adm' ) . esc_attr( strip_tags( get_the_content() ) ) ) : ( esc_attr( strip_tags( get_the_title() ) ) ); $image = ( has_post_thumbnail() ) ? ( get_the_post_thumbnail( null, 'widget', array( 'title' => $imageTitle ) ) ) : ( '' ); $image = ( ! has_post_thumbnail() && $overlay ) ? ( '' ) : ( $image ); $hasThumb = ( $image ) ? ( ' has-thumb' ) : ( ' no-thumb' ); if ( 'post' == get_post_type( $post_id ) && get_post_format() ) { $icon = get_post_format(); if ( has_post_format( 'status' ) ) $icon = 'user'; echo '<i class="wmicon-' . esc_attr( $icon ) . '"></i>'; } elseif ( 'post' == get_post_type( $post_id ) ) { echo '<i class="wmicon-pencil"></i>'; } echo '<span class="wm-image-container' . $hasThumb . '">'; if ( get_edit_post_link() ) edit_post_link( $image ); else echo '<a href="' . get_permalink() . '">' . $image . '</a>'; echo edit_post_link( $overlay ) . '</span>'; break; case 'wm-template': //page template $tplFile = get_post_meta( $post_id, '_wp_page_template', TRUE ); if ( $tplFile && 'default' != $tplFile ) { $tplName = array_search( $tplFile, get_page_templates() ); edit_post_link( '<strong>"' . $tplName . '"</strong>' ); } break; } }
get_header(); ?> <section class="countdown-timer-wrap"> <div class="wrap-inner"> <?php if ( wm_meta_option( 'construction-date' ) ) echo do_shortcode( '[countdown time="' . ( wm_meta_option( 'construction-date' ) . ' ' . wm_meta_option( 'construction-time' ) ) . '" /]' ); ?> <?php if ( wm_meta_option( 'construction-timer-widgets' ) && is_active_sidebar( wm_meta_option( 'construction-timer-widgets' ) ) ) { echo '<div class="timer-widgets-wrap clearfix">'; wm_sidebar( wm_meta_option( 'construction-timer-widgets' ), 'widgets columns twelve pane', 5 ); //restricted to 5 widgets echo '</div>'; } ?> </div> <!-- /wrap-inner --> </section> <div class="wrap-inner"> <article class="main twelve pane"> <?php do_action( 'wm_start_main_content' ); ?> <?php get_template_part( 'inc/loop/loop', 'singular' ); ?>
<?php do_action( 'wm_before_post' ); ?> <?php do_action( 'wm_start_post' ); ?> <?php global $paged; if ( isset( $paged ) && 2 > $paged ) { $content = ( get_the_content() ) ? ( '<div class="article-content">' . apply_filters( 'the_content', get_the_content() ) . '</div>' ) : ( '' ); echo $content; } ?> <?php $category = wm_meta_option( 'portfolio-category' ); //this may return slug, but the shortcode below will take care of it $columns = wm_meta_option( 'portfolio-columns' ); $count = ( wm_meta_option( 'portfolio-count' ) ) ? ( wm_meta_option( 'portfolio-count' ) ) : ( -1 ); $filter = wm_meta_option( 'portfolio-filter' ); $order = wm_meta_option( 'portfolio-order' ); $pagination = wm_meta_option( 'portfolio-pagination' ); echo do_shortcode( '[projects category="' . $category . '" columns="' . $columns . '" count="' . $count . '" filter="' . $filter . '" order="' . $order . '" pagination="' . $pagination . '" /]' ); ?> <?php do_action( 'wm_end_post' ); ?> <?php wp_reset_query(); do_action( 'wm_after_post' ); endif; ?>