Пример #1
2
/**
 * Enqueue scripts and styles.
 *
 * @since Twenty Fifteen 1.0
 */
function montkailash_scripts()
{
    // Load our main stylesheet.
    wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap.min.css');
    wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/css/bootstrap-theme.min.css');
    wp_enqueue_style('lightbox-style', get_template_directory_uri() . '/css/lightbox.css');
    wp_enqueue_style('montkailash-style', get_stylesheet_uri());
    if (is_page('Contact')) {
        wp_register_script('gmap', "http://maps.google.com/maps/api/js?sensor=true", '', '', true);
        wp_enqueue_script('gmap');
        wp_enqueue_script('gmaps', get_template_directory_uri() . '/js/gmaps.js', array('jquery'), '', true);
        wp_enqueue_script('function-map', get_template_directory_uri() . '/js/function_map.js', array('jquery'), '0.1', true);
    }
    if (!is_admin()) {
        wp_deregister_script('jquery');
        wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js", '', '1.8.3', true);
        wp_enqueue_script('jquery');
        wp_deregister_script('wonderplugin-slider-skins-script');
        wp_deregister_script('wonderplugin-slider-script');
        wp_deregister_script('wonderplugin-slider-creator-script');
        wp_deregister_script('woo-vou-public-script');
        wp_register_script('wonderplugin-slider-skins-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginsliderskins.js', array('jquery'), '4.9', true);
        wp_register_script('wonderplugin-slider-script', plugins_url() . '/wonderplugin-slider/engine/wonderpluginslider.js', array('jquery'), '4.9', true);
        wp_register_script('wonderplugin-slider-creator-script', plugins_url() . '/wonderplugin-slider/app/wonderplugin-slider-creator.js', array('jquery'), '4.9', true);
        wp_register_script('woo-vou-public-script', plugins_url() . '/woocommerce-pdf-vouchers/includes/js/woo-vou-public.js', array('jquery'), '2.4.4', true);
        wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20150330', true);
        wp_enqueue_script('lightbox', get_template_directory_uri() . '/js/lightbox.js', array('jquery'), '2.8.1', true);
        wp_enqueue_script('montkailash-script', get_template_directory_uri() . '/js/functions.js', array('jquery'), '0.1', true);
    }
}
Пример #2
0
function wp_list_pages2($args)
{
    $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $output = '';
    $current_page = 0;
    // sanitize, mostly to keep spaces out
    $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
    // Allow plugins to filter an array of excluded pages
    $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
    // Query pages.
    $r['hierarchical'] = 0;
    $pages = get_pages($r);
    if (!empty($pages)) {
        if ($r['title_li']) {
            $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
        }
        global $wp_query;
        if (is_page() || $wp_query->is_posts_page) {
            $current_page = $wp_query->get_queried_object_id();
        }
        $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
        if ($r['title_li']) {
            $output .= '</ul></li>';
        }
    }
    $output = apply_filters('wp_list_pages', $output);
    if ($r['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
Пример #3
0
 /**
  *  Check if a cookie is set for the current page
  *
  * @return Ai1ec_Cookie_Present_Dto
  */
 public function is_cookie_set_for_current_page()
 {
     $cookie_dto = $this->_registry->get('cookie.dto');
     $settings = $this->_registry->get('model.settings');
     $calendar_url = get_page_link($settings->get('calendar_page_id'));
     $requested_page_url = Ai1ec_Wp_Uri_Helper::get_current_url(true);
     $cookie_set = isset($_COOKIE['ai1ec_saved_filter']);
     if (false !== $cookie_set) {
         $cookie = json_decode(stripslashes($_COOKIE['ai1ec_saved_filter']), true);
         if ($calendar_url === $requested_page_url && isset($cookie['calendar_page']) && $cookie['calendar_page'] !== $calendar_url) {
             $cookie_dto->set_calendar_cookie($cookie['calendar_page']);
             $cookie_dto->set_is_cookie_set_for_calendar_page(true);
             $cookie_dto->set_is_a_cookie_set_for_this_page(true);
         } else {
             if (isset($cookie[$requested_page_url])) {
                 $cookie_dto->set_shortcode_cookie($cookie[$requested_page_url]);
                 $cookie_dto->set_is_cookie_set_for_shortcode(true);
                 $cookie_dto->set_is_a_cookie_set_for_this_page(true);
             } else {
                 if (strpos($requested_page_url, $calendar_url) === 0 && isset($cookie['calendar_page']) && is_page($settings->get('calendar_page_id'))) {
                     // This is the case after a redirect from the calendar page
                     $cookie_dto->set_is_a_cookie_set_for_this_page(true);
                     $cookie_dto->set_calendar_cookie($cookie['calendar_page']);
                 }
             }
         }
     }
     return $cookie_dto;
 }
Пример #4
0
 /**
  * s2Member's Security Gate (protects WordPress content).
  *
  * @package s2Member\Security
  * @since 3.5
  *
  * @attaches-to ``add_action("wp");``
  *
  * @return null May redirect a browser *(exiting script execution)*, when/if content is NOT available to the current User/Member.
  */
 public static function security_gate()
 {
     do_action("ws_plugin__s2member_before_security_gate", get_defined_vars());
     if (is_category()) {
         // Categories & other inclusives.
         c_ws_plugin__s2member_catgs::check_catg_level_access();
     } else {
         if (is_tag()) {
             // Post/Page Tags & other inclusives.
             c_ws_plugin__s2member_ptags::check_ptag_level_access();
         } else {
             if (is_single()) {
                 // All Posts & other inclusives.
                 c_ws_plugin__s2member_posts::check_post_level_access();
             } else {
                 if (is_page()) {
                     // All Pages & other inclusives.
                     c_ws_plugin__s2member_pages::check_page_level_access();
                 } else {
                     // Else, we simply look at URIs & other inclusives.
                     c_ws_plugin__s2member_ruris::check_ruri_level_access();
                 }
             }
         }
     }
     do_action("ws_plugin__s2member_after_security_gate", get_defined_vars());
     return;
 }
 /**
  * 
  * @global type $loginradius_share_settings
  * @return type
  */
 public static function get_vertical_position()
 {
     global $post, $loginradius_share_settings;
     $position['top_left'] = false;
     $position['top_right'] = false;
     $position['bottom_left'] = false;
     $position['bottom_right'] = false;
     // Show on static Pages.
     if (is_page() && !is_front_page() && (isset($loginradius_share_settings['lr-clicker-vr-static']) && $loginradius_share_settings['lr-clicker-vr-static'] == '1')) {
         $position = self::get_vertical_position_option('Static', $position);
     }
     // Show on Front home Page.
     if (is_front_page() && (isset($loginradius_share_settings['lr-clicker-vr-home']) && $loginradius_share_settings['lr-clicker-vr-home'] == '1')) {
         $position = self::get_vertical_position_option('Home', $position);
     }
     // Show on Posts.
     if (is_single() && $post->post_type == 'post' && (isset($loginradius_share_settings['lr-clicker-vr-post']) && $loginradius_share_settings['lr-clicker-vr-post'] == '1')) {
         $position = self::get_vertical_position_option('Post', $position);
     }
     // Show on Custom Post Types
     if (is_single() && $post->post_type != 'post' && (isset($loginradius_share_settings['lr-clicker-vr-custom']) && $loginradius_share_settings['lr-clicker-vr-custom'] == '1')) {
         $position = self::get_vertical_position_option('Custom', $position);
     }
     return $position;
 }
Пример #6
0
function child_add_scripts()
{
    if (is_page('bps')) {
        wp_register_script('bps-script', '/bps.js');
        wp_enqueue_script('bps-script');
    }
}
Пример #7
0
function ninja_forms_get_form_ids_by_post_id($post_id)
{
    global $wpdb;
    $form_ids = array();
    if (is_page($post_id)) {
        $form_results = ninja_forms_get_all_forms();
        if (is_array($form_results) and !empty($form_results)) {
            foreach ($form_results as $form) {
                $form_data = $form['data'];
                if (isset($form_data['append_page']) and !empty($form_data['append_page'])) {
                    if ($form_data['append_page'] == $post_id) {
                        $form_ids[] = $form['id'];
                    }
                }
            }
        }
        $form_id = get_post_meta($post_id, 'ninja_forms_form', true);
        if (!empty($form_id)) {
            $form_ids[] = $form_id;
        }
    } else {
        if (is_single($post_id)) {
            $form_id = get_post_meta($post_id, 'ninja_forms_form', true);
            if (!empty($form_id)) {
                $form_ids[] = $form_id;
            }
        }
    }
    return $form_ids;
}
Пример #8
0
function custom_body_class()
{
    $options = get_desing_plus_option();
    echo ' class="';
    if (!is_page() && is_home()) {
        echo ' index';
    }
    if ($options['header_layout'] == 'fixed') {
        echo ' fixed_header';
    }
    if ($options['layout'] == 'right') {
        echo ' layout1';
    } elseif ($options['layout'] == 'left') {
        echo ' layout2';
    } else {
        echo ' three_column';
    }
    if ($options['layout'] == 'three_column1') {
        echo ' layout3';
    } elseif ($options['layout'] == 'three_column2') {
        echo ' layout4';
    }
    if (is_page_template('page-noside.php')) {
        echo ' no_side';
    }
    echo ' custom-background"';
}
Пример #9
0
function hatom_data_in_content_page($content)
{
    if (is_page()) {
        $content .= get_hatom_data_page();
    }
    return $content;
}
Пример #10
0
    function airballoon_display_custom_header()
    {
        // Get Theme Options from Database
        $options = get_option('zeenoble_options');
        // Don't display header image on template-frontpage.php
        if (is_page_template('template-frontpage.php')) {
            return;
        }
        // Don't display header image when "display frontpage template automatically on home page" option is activated
        if (is_front_page() and isset($options['themeZee_frontpage_activate']) and $options['themeZee_frontpage_activate'] == 'true') {
            return;
        }
        // Check if page is displayed and featured header image is used
        if (is_page() && has_post_thumbnail()) {
            ?>
			<div id="custom-header">
				<?php 
            the_post_thumbnail('frontpage_slider_image');
            ?>
			</div>
<?php 
            // Check if there is a custom header image
        } elseif (get_header_image()) {
            ?>
			<div id="custom-header">
				<img src="<?php 
            echo get_header_image();
            ?>
" />
			</div>
<?php 
        }
    }
Пример #11
0
 function the_content($content)
 {
     // Don't show on custom page templates
     if (is_page_template()) {
         return $content;
     }
     // Don't show on Stacked slides
     if (get_post_type() == 'slide') {
         return $content;
     }
     global $wp_current_filter;
     if (in_array('get_the_excerpt', (array) $wp_current_filter)) {
         return $content;
     }
     $cce_options = get_option('cce_options');
     $show_on_posts = isset($cce_options['show_loveit_button_on']['post']) ? $cce_options['show_loveit_button_on']['post'] : FALSE;
     $show_on_pages = isset($cce_options['show_loveit_button_on']['page']) ? $cce_options['show_loveit_button_on']['page'] : FALSE;
     if (is_singular('post') && $show_on_posts) {
         $content .= $this->do_likes('loveit-after-content');
     }
     if (is_page() && !is_front_page() && $show_on_pages) {
         $content .= $this->do_likes('loveit-after-content');
     }
     //Under consideration: if(( is_front_page() || is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->do_likes();
     return $content;
 }
Пример #12
0
 /**
  * Gets the page type from WordPress.
  *
  * @return string A string representation of the current page type,
  *     corresponding to the values used by publisherplugin.google.com.
  */
 public static function getWordPressPageType()
 {
     // is_front_page() returns true if (1) a static front page is set and this
     // is that page, or (2) the front page is the blog home page and this
     // is the blog home page.
     if (is_front_page()) {
         return 'front';
     }
     if (is_home()) {
         return 'home';
     }
     if (is_single()) {
         return 'singlePost';
     }
     if (is_page()) {
         return 'page';
     }
     if (is_category()) {
         return 'category';
     }
     if (is_archive()) {
         return 'archive';
     }
     if (is_search()) {
         return 'search';
     }
     if (is_404()) {
         return 'errorPage';
     }
     return '';
 }
Пример #13
0
function widget_andreas01_pagenav()
{
    ?>
<h2 class="hide">Site menu:</h2>
<ul class="page">
<?php 
    if (is_page()) {
        $highlight = "page_item";
    } else {
        $highlight = "page_item current_page_item";
    }
    ?>
<li class="<?php 
    echo $highlight;
    ?>
"><a href="<?php 
    bloginfo('url');
    ?>
">Home</a></li>
<?php 
    wp_list_pages('sort_column=menu_order&depth=1&title_li=');
    ?>
</ul>
<?php 
}
Пример #14
0
function tie_register()
{
    ## Register Main style.css file
    wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
    wp_enqueue_style('tie-style');
    ## Register All Scripts
    wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
    wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
    wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
    wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
    wp_register_script('tie-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), false, true);
    ## Get Global Scripts
    wp_enqueue_script('tie-scripts');
    ## Register WooCommerce css file
    wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
    if (class_exists('Woocommerce')) {
        wp_enqueue_style('tie-woocommerce');
    }
    ## Get Validation Script
    if (tie_get_option('comment_validation') && (is_page() || is_single()) && comments_open()) {
        wp_enqueue_script('tie-validation');
    }
    ## For facebook & Google + share
    if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
        tie_og_data();
    }
}
Пример #15
0
function site_scripts()
{
    global $wp_styles;
    // Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
    // Load What-Input files in footer
    wp_enqueue_script('what-input', get_template_directory_uri() . '/vendor/what-input/what-input.min.js', array(), '', true);
    // Adding Foundation scripts file in the footer
    wp_enqueue_script('foundation-js', get_template_directory_uri() . '/assets/js/foundation.min.js', array('jquery'), '6.0', true);
    wp_enqueue_script('sticky-js', get_template_directory_uri() . '/assets/js/jquery.sticky.js', array('jquery'), '6.0', true);
    // Adding Owl Carousel script file in the footer
    wp_enqueue_script('owl-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.js', array('jquery'), '', true);
    //Google MAps API
    if (is_page('about-us') || is_page('contact-us')) {
        wp_enqueue_script('maps-js', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBTfVURGZR7YFppqYW9LVpRCk0xmup0YSg', array('jquery'), '', true);
        wp_enqueue_script('custom-maps-js', get_template_directory_uri() . '/assets/js/mapScripts.js', array('jquery'), '', true);
    }
    if (is_page('blood-testing')) {
        wp_enqueue_script('maps-js', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBTfVURGZR7YFppqYW9LVpRCk0xmup0YSg', array('jquery'), '', true);
        wp_enqueue_script('cluster-maps-js', get_template_directory_uri() . '/assets/js/markerclusterer.js', array('jquery'), '', true);
        wp_enqueue_script('blood-testing-maps-js', get_template_directory_uri() . '/assets/js/bloodMapScripts.js', array('jquery'), '', true);
    }
    if (is_page('skype-call-test-page')) {
        wp_enqueue_script('skype-js', 'http://www.skypeassets.com/i/scom/js/skype-uri.js', array('jquery'), '', true);
        //wp_enqueue_script( 'skype.js', get_template_directory_uri() . '/assets/js/skype.js', array( 'jquery' ), '', true );
    }
    //infinite scroll
    wp_enqueue_script('infinite-scroll-js', '//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js', array('jquery'), '', true);
    //Masonry Grid
    wp_enqueue_script('masonry-js', '//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js', array('jquery'), '', true);
    //Images Loaded
    wp_enqueue_script('images-loaded-js', '//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js', array('jquery'), '', true);
    //jSignature.js
    wp_enqueue_script('jSignature.js', get_template_directory_uri() . '/assets/js/jSignature.min.noconflict.js', array('jquery'), '', true);
    if (is_page_template('template-video-chat.php') || is_singular('consult')) {
        //simpleWebRTC
        //wp_enqueue_script( 'simpleWebRTC.js', 'https://simplewebrtc.com/latest-v2.js', array( 'jquery' ), '', true );
        //wp_enqueue_script( 'video.js', get_template_directory_uri() . '/assets/js/video-scripts.js', array( 'jquery' ), '', true );
    }
    //Video.js
    //wp_enqueue_script( 'video.js', 'https://vjs.zencdn.net/5.5.3/video.js', array( 'jquery' ), '', true );
    //iCheck.js
    //wp_enqueue_script( 'iCheck.js', get_template_directory_uri() . '/assets/js/icheck.min.js', array( 'jquery' ), '', true );
    //EnrollForm.js
    wp_enqueue_script('enrollForm.js', get_template_directory_uri() . '/assets/js/enroll-form.js', array('jquery'), '', true);
    //Stellar.js
    wp_enqueue_script('stellar.js', get_template_directory_uri() . '/assets/js/jquery.stellar.js', array('jquery'), '', true);
    //countTo.JS
    wp_enqueue_script('countUp.js', get_template_directory_uri() . '/assets/js/jquery.countTo.js', array('jquery'), '', true);
    // Adding Waypoints script file in the footer
    wp_enqueue_script('waypoints', get_template_directory_uri() . '/assets/js/jquery.waypoints.js', array('jquery'), '', true);
    wp_enqueue_script('waypoints-inview', get_template_directory_uri() . '/assets/js/inview.js', array('jquery'), '', true);
    // Adding scripts file in the footer
    wp_enqueue_script('site-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '', true);
    // Register main stylesheet
    wp_enqueue_style('site-css', get_template_directory_uri() . '/assets/css/style.css', array(), '', 'all');
    // Comment reply script for threaded comments
    if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
        wp_enqueue_script('comment-reply');
    }
}
Пример #16
0
/**
 * Enqueue scripts and styles.
 */
function jbaths_scripts()
{
    $theme = wp_get_theme();
    // wtf
    wp_enqueue_style('wtf-forms', get_template_directory_uri() . '/css/wtf-forms.css', array(), '2.2.0');
    // and then
    wp_enqueue_style('jbaths', get_stylesheet_uri(), array(), $theme->Version . '.1');
    // store locator plus - specialty css
    if (is_page('find-a-showroom')) {
        wp_enqueue_style('jbaths-slp', get_template_directory_uri() . '/css/slp-baths.css', array(), $theme->Version);
        // store locator plus
    }
    if (!is_admin()) {
        wp_register_script('jbaths.modernizr', get_stylesheet_directory_uri() . '/js/modernizr.min.js', array(), '2.8.3', true);
        wp_register_script('jquery.cookie', get_stylesheet_directory_uri() . '/js/jquery.cookie.js', array('jquery'), $theme->Version);
        wp_register_script('scrollupforwhat', get_stylesheet_directory_uri() . '/js/jquery.scrollupforwhat.min.js', array('jquery'), '1.2', true);
        wp_register_script('matchHeight', get_template_directory_uri() . '/js/jquery.matchHeight.js', array('jquery'), '0.5.2', true);
        $jbaths_deps = array('jquery', 'jbaths.modernizr', 'jquery.cookie', 'scrollupforwhat', 'matchHeight');
        if (is_singular('bathtubs') || is_singular('faucets')) {
            if (get_option('ultimate_row') == "enable") {
                //$jbaths_deps[] = 'ultimate-row-bg';
            }
        }
        wp_enqueue_script('jbaths', get_template_directory_uri() . '/js/baths.js', $jbaths_deps, '20140718', true);
    }
    wp_enqueue_script('skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
    // Omniture SiteCatalyst
    wp_enqueue_script('sitecatalyst', get_template_directory_uri() . '/js/s_code.js', array(), $theme->Version, true);
    if (is_singular('post') && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
 function build_content($content)
 {
     $return = $content;
     if (is_single() && in_the_loop() || is_page() && in_the_loop()) {
         global $post, $authordata, $wpautbox_lite;
         $this->post = $post;
         $this->authordata = $authordata;
         $this->settings = $wpautbox_lite;
         $this->allowed_post_types();
         //initialize return element
         if (isset($this->show_in[$this->post->post_type]) && 'no' != $this->show_in[$this->post->post_type]) {
             switch ($this->show_in[$this->post->post_type]) {
                 case 'above':
                     $return = $this->construct_authorbox('above', $this->authordata->ID);
                     $return .= $content;
                     break;
                 case 'below':
                     $return = $content;
                     $return .= $this->construct_authorbox('below', $this->authordata->ID);
                     break;
                 case 'both':
                     $return = $this->construct_authorbox('above', $this->authordata->ID);
                     $return .= $content;
                     $return .= $this->construct_authorbox('below', $this->authordata->ID);
                     break;
                 default:
                     $return = $content;
                     break;
             }
         }
     }
     return $return;
 }
Пример #18
0
function add_custom_class($classes = array(), $menu_item = false)
{
    if (!is_page() && 'Trükkök' == $menu_item->title && !in_array('current-menu-item', $classes)) {
        $classes[] = 'current-menu-item';
    }
    return $classes;
}
    /**
     *
     *	Return the form used within the modal for saving user info
     *
     *	@since 1.0
     */
    function draw_modal()
    {
        if (is_user_logged_in() && is_page('dashboard')) {
            ?>

		<div class="modal fade modal--user-info modal--centered" id="modal--user-info" tabindex="-1" role="dialog">
		    <div class="modal-dialog modal-sm">
			  	<div class="modal-content">
			  		<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h4 class="modal-title" id="gridSystemModalLabel">User Information</h4>
        				<p>Providing this data will help us understand who is using our site!</p>
					</div>
					<div class="modal-body">
						<?php 
            self::draw_form();
            ?>
					</div>
				</div>
			</div>
		</div>

		<?php 
        }
    }
Пример #20
0
 public function filter_the_content($content)
 {
     $ww_problem = false;
     if (is_page('webwork')) {
         $ww_problem = true;
     } else {
         $ww_problem = get_query_var('ww_problem');
     }
     if ($ww_problem) {
         $content = '<div id="webwork-app"></div>';
         wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js');
         $route_base = get_option('home');
         $route_base = preg_replace('|https?://[^/]+/|', '', $route_base);
         // @todo Centralize this logic.
         $main_site_url = get_blog_option(1, 'home');
         $rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/';
         // @todo Abstract.
         $post_data = null;
         $ww_problem_text = '';
         if (!empty($_GET['post_data_key'])) {
             $post_data = get_blog_option(1, $_GET['post_data_key']);
             $ww_problem_text = base64_decode($post_data['pg_object']);
         }
         // @todo This is awful.
         $clients = get_blog_option(1, 'webwork_clients');
         $remote_course_url = array_search(get_current_blog_id(), $clients);
         wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in()));
         wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css');
         wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js');
         $webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full'));
         wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings);
         wp_enqueue_script('webwork-mathjax-loader');
     }
     return $content;
 }
Пример #21
0
function load_main_scripts()
{
    wp_register_script('scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), filemtime(get_template_directory() . '/assets/js/scripts.js'), true);
    // Loads in the footer with cache busting
    wp_register_script('collapsible', get_template_directory_uri() . '/assets/js/jquery.collapsible.min.js', array('jquery'), 1.0, true);
    wp_register_script('modernizer', get_template_directory_uri() . '/assets/js/modernizr-2.6.1-respond-1.1.0.min.js');
    wp_register_script('magnific', get_template_directory_uri() . '/assets/js/jquery.magnific.min.js', array('jquery'));
    wp_register_script('select', get_template_directory_uri() . '/assets/js/bootstrap-select.min.js', array('jquery'));
    wp_register_script('dropdown', get_template_directory_uri() . '/assets/js/bootstrap-dropdown.js', array('jquery'), 1.0, true);
    wp_register_script('fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array('jquery'), 1.0, true);
    wp_register_script('tabaccord', get_template_directory_uri() . '/assets/js/easyResponsiveTabs.js', array('jquery'), 1.0, true);
    //wp_register_script( 'placeholders', get_template_directory_uri() . '/assets/js/Placeholders.js', array( 'jquery' ), 1.0, true  );
    //wp_register_script( 'glossary', get_template_directory_uri() . '/assets/js/jquery.zglossary.min.js', array( 'jquery' ), 1.0, true  );
    wp_enqueue_script('modernizer');
    wp_enqueue_script('scripts');
    wp_enqueue_script('select');
    wp_enqueue_script('dropdown');
    wp_enqueue_script('magnific');
    wp_enqueue_script('fitvids');
    //wp_enqueue_script( 'placeholders' );
    wp_enqueue_script('tabaccord');
    if (is_page() or get_post_type() == 'state' or get_post_type() == 'faq') {
        wp_enqueue_script('collapsible');
    }
    if (!is_front_page() or !is_post_type_archive('glossary')) {
        wp_enqueue_script('glossary');
    }
    if (is_page_template('page-templates/template-video-gallery.php')) {
        // load only on video gallery
        wp_enqueue_script('lazyYT', get_template_directory_uri() . '/assets/js/lazyYT.js', array('jquery'), 1.0, true);
        // lazy load youtube
    }
}
 public function testThemeTemplateIsCorrectForPage()
 {
     $page = $this->factory->post->create(array('post_type' => 'page'));
     $this->go_to_with_template(get_permalink($page));
     $this->assertTrue(is_page());
     $this->assertSame('page.php', self::get_theme_data('template_file'));
 }
Пример #23
0
function sp_post_info_filter($post_info)
{
    if (!is_page()) {
        $post_info = '';
        return $post_info;
    }
}
Пример #24
0
function znpb_add_kallyas_template($current_layout, $post, $post_id)
{
    if (!is_page($post_id)) {
        return $current_layout;
    }
    $sidebar_pos = get_post_meta($post_id, 'zn_page_layout', true);
    $sidebar_to_use = get_post_meta($post_id, 'zn_sidebar_select', true);
    $subheader_style = get_post_meta($post_id, 'zn_subheader_style', true) !== '0' ? get_post_meta($post_id, 'zn_subheader_style', true) : 'zn_def_header_style';
    $sidebar_saved_data = zget_option('page_sidebar', 'unlimited_sidebars', false, array('layout' => 'right_sidebar', 'sidebar' => 'defaultsidebar'));
    if ($sidebar_pos == 'default' || empty($sidebar_pos)) {
        $sidebar_pos = $sidebar_saved_data['layout'];
    }
    if ($sidebar_to_use == 'default' || empty($sidebar_to_use)) {
        $sidebar_to_use = $sidebar_saved_data['sidebar'];
    }
    // We will add the new elements here
    $sidebar = ZNPB()->add_module_to_layout('TH_Sidebar', array('sidebar_select' => $sidebar_to_use));
    $sidebar_column = ZNPB()->add_module_to_layout('ZnColumn', array(), array($sidebar), 'col-sm-3');
    $sections[] = ZNPB()->add_module_to_layout('TH_CustomSubHeaderLayout', array('hm_header_style' => $subheader_style));
    // If the sidebar was saved as left sidebar
    if ($sidebar_pos == 'left_sidebar') {
        $columns[] = $sidebar_column;
    }
    // Add the main shop content
    $archive_columns = $sidebar_pos == 'no_sidebar' ? 4 : 3;
    $textbox = ZNPB()->add_module_to_layout('TH_TextBox', array('stb_title' => $post->post_title, 'stb_content' => $post->post_content));
    $columns[] = ZNPB()->add_module_to_layout('ZnColumn', array(), array($textbox), 'col-sm-9');
    // If the sidebar was saved as right sidebar
    if ($sidebar_pos == 'right_sidebar') {
        $columns[] = $sidebar_column;
    }
    $sections[] = ZNPB()->add_module_to_layout('ZnSection', array(), $columns, 'col-sm-12');
    return $sections;
}
Пример #25
0
/**
 * 
 * @global type $post
 * 
 */
function dfi_download_featured_images()
{
    global $post;
    //get featured enable lists
    $post_options = (array) json_decode(get_option('featured_enable'));
    $singular = '';
    $is_page = '';
    if (!empty($post_options['page'])) {
        $is_page = is_page();
        unset($post_options['page']);
    }
    if (!empty($post_options)) {
        $post_options = array_values($post_options);
        $singular = is_singular($post_options);
    } else {
        $singular = $is_page;
    }
    if (!empty($post_options) && $is_page != '') {
        $singular = $is_page || $singular;
    }
    //    echo '<pre>';
    //    print_r($post_options);
    //    exit;
    if ($singular && has_post_thumbnail()) {
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
        $icon = get_post_meta($post->ID, 'featured_download', true);
        if ($url[0] != '' && $icon == 'yes') {
            dfi_add_download_button($url[0]);
        }
    }
}
function sfhiv_add_event_filter()
{
    $archive_type = mini_archive_on_page(get_the_ID());
    if (is_page() && $archive_type && $archive_type == 'event') {
        get_template_part("nav", "event");
    }
}
Пример #27
0
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function siteorigin_north_body_classes($classes)
{
    // Adds a class of group-blog to blogs with more than 1 published author.
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    $classes[] = 'no-js';
    $classes[] = 'css3-animations';
    $classes[] = 'responsive';
    if (is_page()) {
        $classes[] = 'page-layout-' . SiteOrigin_Settings_Page_Settings::get('layout');
        $classes[] = 'page-layout-menu-' . SiteOrigin_Settings_Page_Settings::get('menu');
        if (!SiteOrigin_Settings_Page_Settings::get('masthead_margin')) {
            $classes[] = 'page-layout-no-masthead-margin';
        }
        if (!SiteOrigin_Settings_Page_Settings::get('footer_margin')) {
            $classes[] = 'page-layout-no-footer-margin';
        }
    }
    if (!is_active_sidebar('main-sidebar')) {
        $classes[] = 'no-active-sidebar';
    }
    if (siteorigin_setting('navigation_sticky')) {
        $classes[] = 'sticky-menu';
    }
    if (wp_is_mobile()) {
        $classes[] = 'is_mobile';
    }
    return $classes;
}
Пример #28
0
function MyBreadcrumb()
{
    if (!is_home()) {
        echo '<li><a href="';
        echo get_option('home');
        echo '/">';
        echo 'Home';
        echo '</a><span class="divider">/</span></li>';
        if (is_category() || is_single()) {
            echo '<li>';
            the_category(', ', '&title_li=');
            echo '<span class="divider">/</span></li>';
            echo '</li>';
            if (is_single()) {
                echo '<li class="active">';
                // the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
}
/**
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 *
 * @return void
 */
function wc_template_redirect()
{
    global $wp_query, $wp;
    // When default permalinks are enabled, redirect shop page to post type archive url
    if (!empty($_GET['page_id']) && get_option('permalink_structure') == "" && $_GET['page_id'] == wc_get_page_id('shop')) {
        wp_safe_redirect(get_post_type_archive_link('product'));
        exit;
    } elseif (is_page(wc_get_page_id('checkout')) && sizeof(WC()->cart->get_cart()) == 0 && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received'])) {
        wp_redirect(get_permalink(wc_get_page_id('cart')));
        exit;
    } elseif (isset($wp->query_vars['customer-logout'])) {
        wp_redirect(str_replace('&amp;', '&', wp_logout_url(get_permalink(wc_get_page_id('myaccount')))));
        exit;
    } elseif (is_search() && is_post_type_archive('product') && apply_filters('woocommerce_redirect_single_search_result', true) && $wp_query->found_posts == 1) {
        $product = wc_get_product($wp_query->post);
        if ($product->is_visible()) {
            wp_safe_redirect(get_permalink($product->id), 302);
            exit;
        }
    } elseif (is_add_payment_method_page()) {
        WC()->payment_gateways();
    } elseif (is_checkout()) {
        // Buffer the checkout page
        ob_start();
        // Ensure gateways and shipping methods are loaded early
        WC()->payment_gateways();
        WC()->shipping();
    }
}
/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}