Ejemplo n.º 1
0
 function content($block)
 {
     //Add action for footer
     do_action('headway_before_footer');
     echo "\n" . '<div class="footer-container">' . "\n";
     echo "\n" . '<div class="footer">' . "\n";
     do_action('headway_footer_open');
     //Headway Attribution
     if (parent::get_setting($block, 'hide-headway-attribution', false) == false) {
         self::show_headway_link();
     }
     //Go To Top Link
     if (parent::get_setting($block, 'show-go-to-top-link', true) == true) {
         self::show_go_to_top_link();
     }
     //Admin Link
     if (parent::get_setting($block, 'show-admin-link', true) == true) {
         self::show_admin_link();
     }
     //Copyright
     if (parent::get_setting($block, 'show-copyright', true) == true) {
         self::show_copyright(parent::get_setting($block, 'custom-copyright'));
     }
     if (parent::get_setting($block, 'show-responsive-grid-link', true) == true) {
         self::show_responsive_grid_toggle_link();
     }
     do_action('headway_footer_close');
     echo "\n" . '</div><!-- .footer -->';
     echo "\n" . '</div><!-- .footer-container -->';
     do_action('headway_after_footer');
 }
Ejemplo n.º 2
0
 function content($block)
 {
     //Use header image if there is one
     if ($header_image_src = parent::get_setting($block, 'header-image')) {
         do_action('headway_before_header_link');
         if (parent::get_setting($block, 'resize-header-image', true)) {
             $block_width = HeadwayBlocksData::get_block_width($block);
             $block_height = HeadwayBlocksData::get_block_height($block);
             $header_image_url = headway_resize_image($header_image_src, $block_width, $block_height);
         } else {
             $header_image_url = $header_image_src;
         }
         echo '<a href="' . home_url() . '" class="banner-image"><img src="' . $header_image_url . '" alt="' . get_bloginfo('name') . '" /></a>';
         do_action('headway_after_header_link');
         //No image present
     } else {
         do_action('headway_before_header_link');
         echo '<span class="banner"><a href="' . home_url() . '">' . get_bloginfo('name') . '</a></span>';
         do_action('headway_after_header_link');
         if (!parent::get_setting($block, 'hide-tagline', false)) {
             if ((is_front_page() || is_home()) && get_option('show_on_front') != 'page') {
                 echo '<h1 class="tagline">' . get_bloginfo('description') . '</h1>' . "\n";
             } else {
                 echo '<span class="tagline">' . get_bloginfo('description') . '</span>' . "\n";
             }
             do_action('headway_after_tagline');
         }
     }
 }
Ejemplo n.º 3
0
 function content($block)
 {
     $content = parent::get_setting($block, 'content');
     if ($content != null) {
         echo headway_parse_php(do_shortcode(stripslashes($content)));
     } else {
         echo '<p>There is no custom code to display.</p>';
     }
 }
Ejemplo n.º 4
0
 /** 
  * Anything in here will be displayed when the block is being displayed.
  **/
 function content($block)
 {
     //The third argument in the following function is the default that will be returned if the setting is not present in the database
     $example_input_value = parent::get_setting($block, 'example-input', null);
     if ($example_input_value == null) {
         echo '<p>The example input has nothing in it yet!</p>';
     } else {
         echo '<p>Here\'s what the example input has for a value: ' . $example_input_value . '</p>';
     }
 }
Ejemplo n.º 5
0
 function content($block)
 {
     $content = parent::get_setting($block, 'content');
     echo '<div class="entry-content">';
     if ($content != null) {
         echo do_shortcode(stripslashes($content));
     } else {
         echo '<p>There is no content to display.</p>';
     }
     echo '</div><!-- .entry-content -->';
 }
Ejemplo n.º 6
0
 function content($block)
 {
     echo parent::get_setting($block, 'horizontal-widgets') == true ? '<ul class="widget-area horizontal-sidebar">' : '<ul class="widget-area">';
     if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('widget-area-' . $block['id'])) {
         echo '<li class="widget widget-no-widgets">';
         echo '<span class="widget-title">No widgets!</span>';
         echo '<p>Add widgets to this sidebar in the <a href="' . admin_url('widgets.php') . '">Widgets panel</a> under Appearance in the WordPress Admin.</p>';
         echo '</li>';
     }
     echo '</ul>';
 }
Ejemplo n.º 7
0
 function content($block)
 {
     $images = parent::get_setting($block, 'images', array());
     $block_width = HeadwayBlocksData::get_block_width($block);
     $block_height = HeadwayBlocksData::get_block_height($block);
     $has_images = false;
     foreach ($images as $image) {
         if ($image['image']) {
             $has_images = true;
             break;
         }
     }
     if (!$has_images) {
         echo '<div class="alert alert-yellow"><p>There are no images to display.</p></div>';
         return;
     }
     $no_slide_class = count($images) === 1 ? ' flexslider-no-slide' : '';
     echo '<div class="flexslider' . $no_slide_class . '">';
     /* Put in viewport div for sliders that only have 1 image and don't slide */
     if (count($images) === 1) {
         echo '<div class="flex-viewport">';
     }
     echo '<ul class="slides">';
     foreach ($images as $image) {
         if (!$image['image']) {
             continue;
         }
         $output = array('image' => array('src' => parent::get_setting($block, 'crop-resize-images', true) ? headway_resize_image($image['image'], $block_width, $block_height) : $image['image'], 'alt' => headway_fix_data_type(headway_get('image-alt', $image)), 'title' => headway_fix_data_type(headway_get('image-title', $image)), 'caption' => headway_fix_data_type(headway_get('image-description', $image))), 'hyperlink' => array('href' => headway_fix_data_type(headway_get('image-hyperlink', $image)), 'target' => headway_fix_data_type(headway_get('image-open-link-in-new-window', $image, false)) ? ' target="_blank"' : null));
         echo '<li>';
         /* Open hyperlink if user added one for image */
         if ($output['hyperlink']['href']) {
             echo '<a href="' . $output['hyperlink']['href'] . '"' . $output['hyperlink']['target'] . '>';
         }
         /* Don't forget to display the ACTUAL IMAGE */
         echo '<img src="' . $output['image']['src'] . '" alt="' . $output['image']['alt'] . '" title="' . $output['image']['title'] . '" />';
         /* Closing tag for hyperlink */
         if ($output['hyperlink']['href']) {
             echo '</a>';
         }
         /* Caption */
         if (!empty($output['image']['caption'])) {
             echo '<p class="flex-caption">' . $output['image']['caption'] . '</p>';
         }
         echo '</li>';
     }
     echo '</ul>';
     /* Put in viewport div for sliders that only have 1 image and don't slide */
     if (count($images) === 1) {
         echo '</div><!-- .flex-viewport -->';
     }
     echo '</div><!-- .flexslider -->';
 }
Ejemplo n.º 8
0
 function content($block)
 {
     if ($embed_url = parent::get_setting($block, 'embed-url', false)) {
         $block_width = HeadwayBlocksData::get_block_width($block);
         $block_height = HeadwayBlocksData::get_block_height($block);
         $embed_code = wp_oembed_get($embed_url, array('width' => $block_width, 'height' => $block_height));
         //Make the width and height exactly what the block's dimensions are.
         $embed_code = preg_replace(array('/width="\\d+"/i', '/height="\\d+"/i'), array('width="' . $block_width . '"', 'height="' . $block_height . '"'), $embed_code);
         echo $embed_code;
     } else {
         echo '<div class="alert alert-yellow"><p>There is no content to display.  Please enter a valid embed URL in the visual editor.</p></div>';
     }
 }
Ejemplo n.º 9
0
 /** 
  * Anything in here will be displayed when the block is being displayed.
  **/
 function content($block)
 {
     global $SlideDeckPlugin;
     /* Make sure SlideDeck is activated and working */
     if (!is_object($SlideDeckPlugin)) {
         echo '<div class="alert alert-red"><p>SlideDeck must be installed and activated in order for the SlideDeck block to work properly.</p></div>';
         return;
     }
     /* Get the chosen SlideDeck ID */
     $slidedeck_id = parent::get_setting($block, 'slidedeck-id', null);
     /* Make sure that there's a selected SlideDeck */
     if (empty($slidedeck_id)) {
         echo '<div class="alert alert-red"><p>Please choose a SlideDeck to display.</p></div>';
         return;
     }
     $slidedeck_query = $SlideDeckPlugin->SlideDeck->get($slidedeck_id);
     if (empty($slidedeck_query)) {
         echo '<div class="alert alert-red"><p>The SlideDeck you previously chose must\'ve been deleted or moved elsewhere.  Please select another SlideDeck to display.</p></div>';
         return;
     }
     /* Setup arguments */
     $args = array('id' => $slidedeck_id, 'width' => null, 'height' => null);
     if (parent::get_setting($block, 'use-block-size', true)) {
         $args['width'] = HeadwayBlocksData::get_block_width($block);
         $args['height'] = HeadwayBlocksData::get_block_height($block);
         $args['proportional'] = false;
     }
     if (HeadwayRoute::is_visual_editor_iframe()) {
         $args['iframe'] = true;
     }
     if (!HeadwayRoute::is_visual_editor_iframe() && HeadwayResponsiveGrid::is_active()) {
         $args['ress'] = true;
     }
     /* Work around for iframe dimensions */
     $GLOBALS['slidedeck-width'] = $args['width'];
     $GLOBALS['slidedeck-height'] = $args['height'];
     add_filter('slidedeck_dimensions', array(__CLASS__, 'modify_slidedeck_iframe_size_for_ajax'), 10, 5);
     /* End work around for iframe dimensions */
     /* Show the SlideDeck! */
     echo $SlideDeckPlugin->shortcode($args);
     /* Remove any filters if necessary */
     remove_filter('slidedeck_dimensions', array(__CLASS__, 'modify_slidedeck_iframe_size_for_ajax'));
     if (isset($GLOBALS['slidedeck-width'])) {
         unset($GLOBALS['slidedeck-width']);
     }
     if (isset($GLOBALS['slidedeck-height'])) {
         unset($GLOBALS['slidedeck-height']);
     }
     /* End removing filters */
 }
Ejemplo n.º 10
0
 function content($block)
 {
     $form_id = parent::get_setting($block, 'form-id', null);
     //If no form ID is present, display the message and stop this function.
     if (!$form_id) {
         echo '<p>There is no form to display.</p>';
         return;
     }
     $display_title = parent::get_setting($block, 'display-title', true);
     $display_description = parent::get_setting($block, 'display-description', true);
     $force_display = true;
     $field_values = null;
     $use_ajax = parent::get_setting($block, 'use-ajax', false);
     echo RGForms::get_form($form_id, $display_title, $display_description, $force_display, null, $use_ajax);
 }
Ejemplo n.º 11
0
 /**
  * Created this function to make the call a little shorter.
  **/
 function get_setting($setting, $default = null)
 {
     return HeadwayBlockAPI::get_setting($this->block, $setting, $default);
 }
Ejemplo n.º 12
0
 public static function home_link_filter($menu)
 {
     $block = self::$block;
     if (parent::get_setting($block, 'hide-home-link')) {
         return $menu;
     }
     if (get_option('show_on_front') == 'posts') {
         $current = is_home() || is_front_page() ? ' current_page_item' : null;
         $home_text = parent::get_setting($block, 'home-link-text') ? parent::get_setting($block, 'home-link-text') : 'Home';
         /* If it's not the grid, then do not add the extra <span>'s */
         if (!HeadwayRoute::is_grid() && !headway_get('ve-live-content-query', $block)) {
             $home_link = '<li class="menu-item-home headway-home-link' . $current . '"><a href="' . home_url() . '">' . $home_text . '</a></li>';
         } else {
             $home_link = '<li class="menu-item-home headway-home-link' . $current . '"><a href="' . home_url() . '"><span>' . $home_text . '</span></a></li>';
         }
     } else {
         $home_link = null;
     }
     return $home_link . $menu;
 }
Ejemplo n.º 13
0
 function content($block)
 {
     /* If Yoast's breadcrumbs are activated then use them instead */
     if (function_exists('yoast_breadcrumb')) {
         return yoast_breadcrumb('<p class="breadcrumbs yoastbreadcrumb">', '</p>');
     }
     wp_reset_query();
     /* Set up variables */
     global $post;
     $breadcrumbs = array();
     $breadcrumbs[home_url()] = __('Home', 'headway');
     /* Handle blogs that aren't set to the homepage */
     if (get_option('show_on_front') == 'page' && get_option('page_for_posts') !== get_option('page_on_front')) {
         /* If the blog is set to a page rather than homepage, then don't show that fragment if it's a 404, search, or non-post singular */
         if (!is_404() && !is_search() && !(is_singular() && get_post_type() != 'post')) {
             $breadcrumbs[get_page_link(get_option('page_for_posts'))] = get_the_title(get_option('page_for_posts'));
         }
     }
     /* Single Posts */
     if (is_single() && get_post_type() == 'post') {
         $breadcrumbs[] = get_the_category_list(', ');
         $breadcrumbs[] = get_the_title();
     } else {
         if (is_singular() && !is_home() && !is_front_page()) {
             $current_page = array($post);
             /* Get the parent pages of the current page if they exist */
             if (isset($current_page[0]->post_parent)) {
                 while ($current_page[0]->post_parent) {
                     array_unshift($current_page, get_post($current_page[0]->post_parent));
                 }
             }
             /* Add returned pages to breadcrumbs */
             foreach ($current_page as $page) {
                 $breadcrumbs[get_page_link($page->ID)] = $page->post_title;
             }
             /* Categories */
         } else {
             if (is_category()) {
                 $breadcrumbs[] = single_cat_title('', false);
             } else {
                 if (is_search()) {
                     $breadcrumbs[] = __('Search Results For:', 'headway') . ' ' . get_search_query();
                 } else {
                     if (is_author()) {
                         $author = get_queried_object();
                         $breadcrumbs[] = __('Author Archives:', 'headway') . ' ' . $author->display_name;
                     } else {
                         if (is_tag()) {
                             $breadcrumbs[] = __('Tag Archives:', 'headway') . ' ' . single_tag_title('', false);
                         } else {
                             if (is_date()) {
                                 $breadcrumbs[] = __('Archives:', 'headway') . ' ' . get_the_time('F Y');
                             } else {
                                 if (is_404()) {
                                     $breadcrumbs[] = __('Whoops! Page Not Found...', 'headway');
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /* Display the breadcrumbs */
     echo '<p class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">';
     if (parent::get_setting($block, 'show-prefix', false)) {
         echo '<span class="breadcrumbs-prefix">' . parent::get_setting($block, 'prefix-text', __('You Are Here:', 'headway')) . '</span>&ensp;';
     }
     $breadcrumbs = apply_filters('headway_breadcrumbs', $breadcrumbs);
     $breadcrumbs_length = count($breadcrumbs);
     $breadcrumbs_loop_counter = 0;
     foreach ($breadcrumbs as $breadcrumb_url => $breadcrumb) {
         /* Do not show separator before first item */
         if ($breadcrumbs_loop_counter != 0) {
             echo ' <span class="sep">' . parent::get_setting($block, 'separator', '&raquo;') . '</span> ';
         }
         echo '<span typeof="v:Breadcrumb" class="breadcrumb">';
         if (!is_numeric($breadcrumb_url) && $breadcrumbs_loop_counter != $breadcrumbs_length - 1) {
             echo '<a href="' . $breadcrumb_url . '" rel="v:url" property="v:title">' . $breadcrumb . '</a></span>';
         } else {
             echo $breadcrumb;
         }
         echo '</span><!-- .breadcrumb -->';
         $breadcrumbs_loop_counter++;
     }
     echo "\n</p>\n\n";
 }