示例#1
0
 public function put_rev_slider_in_precontent()
 {
     $slider_id_prefix = 'revslider_';
     $slider_id = G1_Elements()->get('slider');
     if (false === strpos($slider_id, $slider_id_prefix)) {
         return;
     }
     $slider_alias = str_replace($slider_id_prefix, '', $slider_id);
     echo do_shortcode('[rev_slider ' . $slider_alias . ']');
 }
示例#2
0
 /**
  * Renders help information about the slider in the Precontent Theme Area.
  */
 public function precontent_render_helpmode()
 {
     $slider = G1_Elements()->get('slider');
     // Render helpmode only when there's no slider
     if (!(is_string($slider) && strlen($slider) > 0)) {
         $out = '';
         $helpmode = G1_Helpmode('slider_here', __('Do you want a slider here?', 'g1_theme'), '<ol>' . '<li>' . __('Create a slider ( check the WordPress Admin Menu - there should be some slider types to choose).', 'g1_theme') . '</li>' . '<li>' . __('When editing a single entry scroll down to the "Single Page Elements" meta box, and choose your previously created slider from the "Slider" dropdown.') . '</li>' . '<li>' . __('When editing a single category or a tag choose your previously created slider from the "Slider" dropdown.') . '</li>' . '<li>' . __('Save', 'g1_theme') . '</li>' . '</ol>', 'info');
         $out .= $helpmode->capture();
         if (strlen($out)) {
             $out = '<div style="position: relative; z-index: 10;">' . $out . '</div>';
         }
         echo $out;
     }
 }
示例#3
0
 /**
  *  Renders related entries for the current post type
  *
  * @return string
  */
 public function render_related_entries()
 {
     $post_type = get_post_type();
     if (post_type_supports($post_type, $this->feature)) {
         if (false !== G1_Elements()->get('related-entries')) {
             add_filter('g1_capture_entry_title_args', array($this, 'filter_capture_entry_title_args'));
             // Capture the template part
             ob_start();
             get_template_part('/lib/g1-relations/template-parts/related_entries', $post_type);
             echo ob_get_clean();
             remove_filter('g1_capture_entry_title_args', array($this, 'filter_capture_entry_title_args'));
         }
     }
 }
示例#4
0
 public function render_in_precontent()
 {
     // new gmaps plugin right now handles map only on single page
     if ($this->is_g1_gmaps_plugin_active()) {
         $post_id = null;
         if (is_singular()) {
             // single page
             global $post;
             $post_id = $post->ID;
         } else {
             if (is_home()) {
                 // blog
                 $post_id = absint(g1_get_theme_option('post_type_post', 'page_for_posts'));
             } else {
                 if (is_post_type_archive('g1_work')) {
                     // works
                     $post_id = absint(g1_get_theme_option('post_type_g1_work', 'page_for_posts'));
                 }
             }
         }
         if ($post_id && function_exists('icl_object_id')) {
             $post_id = absint(icl_object_id($post_id, 'page', true));
         }
         $gmaps_meta = get_post_meta($post_id, '_g1_gmaps_metabox', true);
         // user saved gmaps metabox data
         if (!empty($gmaps_meta) && isset($gmaps_meta['precontent_map_id'])) {
             $precontent_map_id = $gmaps_meta['precontent_map_id'];
             if ($precontent_map_id !== 'none' && $precontent_map_id !== '') {
                 $this->render_g1_gmap($precontent_map_id);
                 $this->mapInPrecontent = true;
             }
             // user have plugin activated but not saved yet metabox (use old setting for new map)
         } else {
             $gmap = G1_Elements()->get('gmap');
             if (!empty($gmap) && $gmap === 'standard') {
                 $global_map_id = g1_get_theme_option('ta_prefooter', 'gmap', 'none');
                 $this->render_g1_gmap($global_map_id);
                 $this->mapInPrecontent = true;
             }
         }
     } else {
         // backward compatibility code
         $gmap = G1_Elements()->get('gmap');
         if (!empty($gmap) && $gmap === 'standard') {
             $this->render_global_gmap();
             $this->mapInPrecontent = true;
         }
     }
 }
示例#5
0
 /**
  * Callback for g1_precontent custom action hook
  *
  * Checks if the current object has some Simple Slider assigned.
  * If yes: it renders slider.
  * If no: it does nothing.
  */
 public function precontent()
 {
     $slider_id = absint(G1_Elements()->get('slider'));
     if (!$slider_id || $this->get_post_type() !== get_post_type($slider_id)) {
         return;
     }
     echo do_shortcode('[simple_slider slider="' . $slider_id . '" class="g1-primary"]');
 }
示例#6
0
/**
 * The Template for displaying work archive|index.
 *
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 *
 * @package G1_Framework
 * @subpackage G1_Theme03
 * @since G1_Theme03 1.0.0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
global $post;
$g1_elems = G1_Elements()->get();
$g1_title = $g1_elems['title'] ? the_title('', '', false) : '';
$g1_subtitle = wp_kses_data(get_post_meta($post->ID, '_g1_subtitle', true));
?>
<article itemscope itemtype="<?php 
g1_render_entry_itemtype();
?>
" id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
    <header class="entry-header">
        <?php 
示例#7
0
                break;
            case 'taxonomy':
                $result = str_replace('-', '_', $name);
                $result = 'taxonomy_' . $result;
                break;
        }
        return $result;
    }
    public function get_term_value($term_taxonomy_id, $setting_id)
    {
        $meta = (array) g1_get_term_meta($term_taxonomy_id, '_g1');
        $val = isset($meta[$setting_id]) ? $meta[$setting_id] : null;
        return $val;
    }
}
/**
 * Quasi-singleton for our G1_Elements
 *
 * @return G1_Elements
 */
function G1_Elements()
{
    static $instance;
    if (!isset($instance)) {
        $instance = new G1_Elements();
    }
    return $instance;
}
// Fire in the hole :)
G1_Elements();
示例#8
0
 */
// Prevent direct script access
if (!defined('ABSPATH')) {
    die('No direct script access allowed');
}
// Custom hook
do_action('g1_sidebar_1_before');
if (apply_filters('g1_sidebar_1', true)) {
    ?>
<!-- BEGIN: #secondary -->
<div id="secondary" class="g1-sidebar widget-area" role="complementary">
	<div class="g1-inner">
		<?php 
    // Custom hook
    do_action('g1_sidebar_1_begin');
    $g1_sidebar = G1_Elements()->get('sidebar-1');
    // Apply custom filter
    $g1_sidebar = apply_filters('g1_sidebar_1_id', $g1_sidebar);
    $g1_sidebar = empty($g1_sidebar) || true === $g1_sidebar ? 'primary' : $g1_sidebar;
    g1_sidebar_render($g1_sidebar);
    // Custom hook
    do_action('g1_sidebar_1_end');
    ?>
	</div>
	<div class="g1-background">
        <div></div>
	</div>	
</div>
<!-- END: #secondary -->
<?php 
}