Example #1
0
function tbr_home_themes_loop($query)
{
    $the_query = new WP_Query(array('post_type' => 'themes', 'posts_per_page' => '4', 'no_found_rows' => true));
    ?>

  <div class="tm-home uk-text-center">
    <h2 class="uk-margin-remove-top">Looking for a new WordPress theme?</h2>
    <p class="uk-article-lead tm-excerpt">Browse our growing collection of free child-themes for awesome Beans framework for WordPress. You won't find any complicated configuration options, the themes are heavily optimized for performance and are easy to customize. </p>
    <div class="tm-themes uk-grid uk-grid-width-1-1 uk-grid-width-medium-1-4 uk-margin-large-top" >

    <?php 
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            global $post;
            $title = get_the_title($post->ID);
            $lowercase_title = strtolower($title);
            $thumb_id = get_post_thumbnail_id();
            $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full-size', true);
            $resized_src = beans_edit_image($thumb_url_array[0], array('resize' => array(295, false), 'crop' => array(0, 0, 295, 350), 'set_quality' => array(100)));
            ?>
      <div class="tm-item uk-margin-medium-bottom">
        <figure class="uk-overlay uk-overlay-hover">
          <img src="<?php 
            echo $resized_src;
            ?>
" class="uk-thumbnail" width="400" alt="<?php 
            the_title();
            ?>
 Child-Theme for the Beans WordPress Theme">
          <div class="uk-overlay-panel uk-flex uk-flex-center uk-flex-middle uk-text-center uk-overlay-background uk-overlay-fade"><?php 
            echo the_title();
            ?>
</div>
          <a class="uk-position-cover" href="<?php 
            echo get_permalink();
            ?>
"></a>
      </figure>

      </div>
    <?php 
        }
    } else {
        ?>
      <div>Sorry, there are no posts to display</div>
    <?php 
    }
    ?>
    </div>
    <p class="uk-text-center">
        First time hearing of Beans? You're in for a treat! <a href="http://www.getbeans.io/" target="_blank" title="Learn more about the Beans framework for WordPress on the official Beans site.">Learn more <span>&raquo;</span></a>
    </p>
  </div>
  <?php 
    wp_reset_query();
}
Example #2
0
function dfh_home_work_loop( $query ) {

  $the_query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => '15', 'no_found_rows' => true ) ); ?>

  <div class="uk-grid uk-grid-match uk-grid-width-1-1 uk-grid-width-small-1-2 uk-grid-width-large-1-3" data-uk-grid-match="{target:'.uk-thumbnail'}">
    <?php 
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            if ($images = get_post_meta(get_the_ID(), 'portfolio_gallery', true)) {
                $image = wp_get_attachment_image_src($images[0], 'full');
                $image_src = beans_edit_image($image[0], array('resize' => array(380, 298, array('center', 'top'))));
            } else {
                $image_src = false;
            }
            ?>
      <div class="tm-item">
        <figure>
          <a rel="bookmark" href="<?php 
            echo get_permalink();
            ?>
" title="Learn more" class="uk-thumbnail">
            <img src="<?php 
            echo $image_src;
            ?>
" class="uk-overlay-scale" width="380" height="300" alt="<?php 
            echo the_title();
            ?>
" />
            <figcaption class="uk-margin-top">
               <h3 class="uk-margin-small-bottom uk-h5"><?php 
            echo the_title();
            ?>
</h3>
               <?php 
            the_excerpt();
            ?>
            </figcaption>
          </a>
        </figure>
      </div>
    <?php 
        }
    } else {
        ?>
      <div>Sorry, there are no posts to display</div>
    <?php 
    }
    ?>
    </div>
  <?php 
    wp_reset_query();
}
Example #3
0
function tbr_theme_intro( $excerpt ) {

  global $post;

  $title = get_the_title($post->ID);
  $github_slug = get_post_meta( $post->ID, 'github_slug', true );
  $download_name = get_post_meta( $post->ID, 'download_name', true );
  $download_path = '/wp-content/downloads/' . $download_name . '?no_cache=1';
  $release_date = get_post_meta( $post->ID, 'release_date', true );
  $terms = get_the_terms($post->ID, 'theme_type');
  $terms_as_text = strip_tags( get_the_term_list( $post->ID, 'resource_type', '', ', ', '' ) );
  $thumb_id = get_post_thumbnail_id();
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full-size', true);
  $resized_src = beans_edit_image( $thumb_url_array[0], array(
    'resize' => array( 750, false )
  ) );

  ?>
  <div class="uk-grid">
    <div class="tm-image uk-width-small-1-1 uk-width-medium-3-5 uk-margin-large-bottom">
      <figure class="uk-thumbnail">
        <img src="<?php echo $resized_src; ?>" width="750" alt="<?php echo $title; ?> Child-Theme for the Beans WordPress Theme" />
      </figure>
    </div>
    <div class="tm-theme-info uk-width-small-1-1 uk-width-medium-2-5">
        <header class="tm-theme-top uk-clearfix uk-float-left">
            <h1 class="uk-margin-remove-top uk-h2"><?php echo $title; ?></h1>
            <p class="uk-article-lead"><?php echo the_excerpt(); ?></p>
        </header>
      <div class="tm-downloads">
          <a class="uk-button uk-button-primary uk-margin-right" href="<?php echo $download_path; ?>" onclick="javascript:_paq.push(['trackEvent', 'Resource', 'Download' '<?php echo $title; ?>']);" title="Download <?php echo $title; ?>" data-uk-tooltip="{pos:'bottom-left'}">Download</a>
          <?php if ( $github_slug != '' ) : ?>
              <a class="tm-text-medium tm-github uk-button uk-margin-right" title="View the <?php echo $title; ?> code on GitHub" href="https://github.com/ThemeButler/<?php echo $github_slug; ?>" target="_blank" data-uk-tooltip="{pos:'bottom-left'}"><i class="uk-icon-github uk-icon-small uk-margin-small-right"></i>View on GitHub</a>
          <?php endif; ?>
      </div>
      <ul class="tm-summary uk-list uk-margin-left-remove uk-clearfix">
        <li>Type: <span><?php echo $terms_as_text; ?></span></li>
        <li>Released: <span><?php the_date('d/m/Y'); ?></span></li>
        <li>Requirements: <span>WordPress 4.0+</span></li>
      </ul>

  </div>
<? }
function tbr_resources_loop($query)
{
    $query_args = array('post_type' => 'resources');
    if ($term_id = beans_get('filter_term_id')) {
        $query_args = array_merge($query_args, array('tax_query' => array(array('taxonomy' => 'resource_type', 'field' => 'term_id', 'terms' => beans_get('filter_term_id')))));
    }
    $the_query = new WP_Query($query_args);
    if (wp_is_mobile()) {
        $filter_id = 'mobile-filters';
    } else {
        $filter_id = 'filters';
    }
    ?>

    <div class="tm-index-wrap tm-portfolio tm-lazy uk-grid-width-1-1 uk-grid-width-small-1-2 uk-grid-width-medium-1-3" data-uk-grid="{gutter: 30, controls: '#<?php 
    echo $filter_id;
    ?>
'}">

		<?php 
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            global $post;
            $thumb_id = get_post_thumbnail_id();
            $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full-size', true);
            $resized_src = beans_edit_image($thumb_url_array[0], array('resize' => array(407, 379, array('center', 'top'))));
            $resource_cats = get_the_terms($post->ID, 'resource_type');
            $resource_cats = array_values($resource_cats);
            for ($cat_count = 0; $cat_count < count($resource_cats); $cat_count++) {
                $resource_type = $resource_cats[$cat_count]->name;
                $lowercase_resource_type = strtolower($resource_type);
                if ($cat_count < count($resource_cats) - 1) {
                    echo ', ';
                }
            }
            ?>
		<div class="tm-item" data-uk-filter="<?php 
            echo $lowercase_resource_type;
            ?>
">
            <div class="uk-article">
                <a rel="bookmark" href="<?php 
            echo get_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
">
                    <img src="<?php 
            echo $resized_src;
            ?>
" width="407" height="378" alt="<?php 
            the_title();
            ?>
" />
                </a>
                <div class="uk-panel uk-panel-box">
    			    <h3 class="uk-margin-top-remove"><a rel="bookmark" href="<?php 
            echo get_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
                    <div class="tm-meta"><?php 
            echo get_the_term_list($post->ID, 'resource_type', '', '');
            echo get_the_term_list($post->ID, 'resource_tags', '', '');
            ?>
</div>
    				<p><?php 
            the_excerpt();
            ?>
</p>
                    <p class="uk-margin-remove"><a rel="bookmark" class="uk-button uk-button-small uk-button-secondary" href="<?php 
            echo get_permalink();
            ?>
" title="Learn more">Learn more</a></p>
    			</div>
            </div>
		</div>
		<?php 
        }
    } else {
        ?>
			<p>Sorry, there are no posts to display</p>
		<?php 
    }
    ?>
	</div>
	<?php 
    wp_reset_query();
}
Example #5
0
/**
 * Edit post attachment.
 *
 * This function is shortuct of {@see beans_edit_image()}. It should be used to edit a post attachment.
 *
 * @since 1.0.0
 *
 * @param array  $args {
 *      Array of arguments used by the image editor.
 *
 * 		@type array $resize 	 Numeric array matching the {@link http://codex.wordpress.org/Class_Reference/WP_Image_Editor WP_Image_Editor} resize
 * 		      					 function arguments.
 * 		@type array $crop  	     Numeric array matching the {@link http://codex.wordpress.org/Class_Reference/WP_Image_Editor WP_Image_Editor} crop
 * 		      					 function arguments.
 * 		@type array $rotate      Numeric array matching the {@link http://codex.wordpress.org/Class_Reference/WP_Image_Editor WP_Image_Editor} rotate
 * 		      				     function arguments.
 * 		@type array $flip        Numeric array matching the {@link http://codex.wordpress.org/Class_Reference/WP_Image_Editor WP_Image_Editor} flip
 * 		      				     function arguments.
 * 		@type array $set_quality Numeric array matching the {@link http://codex.wordpress.org/Class_Reference/WP_Image_Editor WP_Image_Editor} set_quality
 * 		      					 function arguments. Default 100.
 * }
 *
 * @return object Edited post attachment data.
 */
function beans_edit_post_attachment($post_id, $args = array())
{
    if (!has_post_thumbnail($post_id)) {
        return false;
    }
    // Get full size image.
    $attachement = beans_get_post_attachment($post_id, 'full');
    if (!($edited = beans_edit_image($attachement->src, $args, 'ARRAY_A'))) {
        return false;
    }
    return (object) array_merge((array) $attachement, $edited);
}
Example #6
0
function dfh_portfolio_gallery() {

  global $post;

  $images = get_post_meta( $post->ID, 'portfolio_gallery', true );

  ?>
  <h2 class="uk-margin-large-top">Screenshots</h2>
  <div class="tm-gallery uk-grid uk-grid-width-1-1 uk-grid-width-small-1-2 uk-grid-width-medium-1-3">
    <?php 
    foreach ((array) $images as $image_id) {
        $image = wp_get_attachment_image_src($image_id, 'full');
        $full_src = $image[0];
        $url = $full_src;
        $file = substr($url, strrpos($url, '/') + 1, strlen($url) - strrpos($url, '/'));
        $newfile = substr($file, 0, strrpos($file, '.'));
        $caption = str_replace('-', ' ', $newfile);
        $resized_src = beans_edit_image($full_src, array('resize' => array(260, 203, array('center', 'top'))));
        ?>
      <figure>
        <a href="<?php 
        echo $full_src;
        ?>
" class="uk-overlay uk-overlay-hover uk-thumbnail" data-uk-lightbox="{group:'<?php 
        echo $post->ID;
        ?>
'}" title="<?php 
        echo $caption;
        ?>
">
          <img src="<?php 
        echo $resized_src;
        ?>
" />
          <div class="uk-overlay-panel uk-overlay-icon uk-overlay-background"></div>
          <figcaption class="uk-thumbnail-caption uk-text-center"><?php 
        echo $caption;
        ?>
</figcaption>
        </a>
      </figure>
  <?php 
    }
    ?>
  </div>
<?php 
}
Example #7
0
function tbr_theme_intro( $excerpt ) {

  global $post;

  $title = get_the_title($post->ID);
  $lowercase_title = strtolower($title);
  $version = get_post_meta( $post->ID, 'version', true );
  $download_child = '/download-' . $lowercase_title . '/?no_cache=1';
  $download_sketch = '/wp-content/downloads/' . $lowercase_title . '-sketch.zip?no_cache=1';
  $release_date = get_post_meta( $post->ID, 'release_date', true );
  $demo_url = 'http://demo.themebutler.com/' . $lowercase_title . '/';
  $terms = get_the_terms($post->ID, 'theme_type');
  $terms_as_text = strip_tags( get_the_term_list( $post->ID, 'theme_type', '', ', ', '' ) );
  $thumb_id = get_post_thumbnail_id();
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full-size', true);
  $full_src = $thumb_url_array[0];
  $resized_src = beans_edit_image( $thumb_url_array[0], array(
    'resize' => array( 750, false )
  ) );

  global $post;
  $images = get_post_meta( $post->ID, 'theme_screenshots', true );
  $the_content = the_content();

?>
  <div class="uk-grid">
    <div class="tm-image uk-width-small-1-1 uk-width-medium-1-2 uk-margin-large-bottom">
      <figure class="uk-overlay uk-overlay-hover uk-thumbnail">
        <img src="<?php echo $resized_src; ?>" width="750" alt="<?php echo $title; ?> Child-Theme for the Beans WordPress Theme" />
        <div class="uk-overlay-panel uk-flex uk-flex-center uk-flex-middle uk-text-center uk-overlay-background uk-overlay-fade"><span class="uk-button uk-button-large">View Screenshots</span></div>
        <a href="<?php echo $full_src; ?>" class="uk-position-cover" data-uk-lightbox="{group:'<?php echo $post->ID; ?>'}"></a>
      </figure>
      <div class="uk-hidden">
          <?php

          foreach ( (array) $images as $image_id ) :

              $image = wp_get_attachment_image_src( $image_id, 'full' );
              $full_src = $image[0];
          ?>
              <a href="<?php echo $full_src; ?>" data-uk-lightbox="{group:\'<?php echo $post->ID; ?>'}" title="View full size"></a>
          <?php endforeach; ?>
      </div>
    </div>
    <div class="tm-theme-info uk-width-small-1-1 uk-width-medium-1-2">
      <header class="tm-theme-top uk-clearfix">
        <h1 class="uk-margin-remove-top uk-float-left"><?php echo $title; ?></h1>
        <div class="tm-theme-nav uk-float-right">
            <?php if ( $release_date != 'TBD' ) : ?>
                <a href="<?php echo $demo_url; ?>" class="uk-button uk-button-primary uk-float-right uk-margin-left tm-demo-link" target="_blank">View Demo</a>
            <?php endif; ?>
            <div class="tm-post-nav uk-float-right uk-margin-left">
                <div class="tm-prev uk-float-left uk-text-left">
                  <?php
                    $prev_post = get_previous_post();
                    if($prev_post) {
                       $prev_title = strip_tags(str_replace('"', '', $prev_post->post_title));
                       echo '<a rel="prev" href="' . get_permalink($prev_post->ID) . '" title="' . $prev_title. '" class="uk-button">&#9756;</a>';
                    }
                  ?>
                </div>
                <div class="tm-next uk-float-right uk-text-right">
                  <?
                    $next_post = get_next_post();
                    if($next_post) {
                       $next_title = strip_tags(str_replace('"', '', $next_post->post_title));
                       echo '<a rel="next" href="' . get_permalink($next_post->ID) . '" title="' . $next_title. '" class="uk-button uk-margin-small-left">&#9758;</a>';
                    }
                  ?>
                </div>
            </div>
        </div>
      </header>
      <p class="uk-article-lead"><?php echo the_excerpt(); ?></p>
      <ul class="tm-summary uk-list uk-margin-left-remove uk-clearfix">
        <li>Type: <span><?php echo $terms_as_text; ?></span></li>
        <li>Released: <span><?php echo $release_date; ?></span></li>
        <li>Requirements: <span>WordPress 4.0+</span></li>
      </ul>
      <div class="uk-grid uk-grid-width-1-1 uk-grid-width-small-1-2">
        <div class="tm-resources">
          <h3 class="uk-margin-top-remove tm-list-style1">Resources</h3>
          <ul class="uk-list tm-list-style1">
            <li><a href="/features/">General Theme Features</a></li>
            <li><a href="/docs/theme-setup-guide">General Setup Guide</a></li>
            <li><a href="/topic/tutorials/">Beans Tutorials</a></li>
            <li><a href="http://www.getbeans.io/documentation/">Beans Documentation <i class="uk-icon-external-link uk-text-small uk-margin-small-left"></i></a></li>
            <li><a href="http://www.getbeans.io/code-snippets/" target="_blank">Useful Code Snippets <i class="uk-icon-external-link uk-text-small uk-margin-small-left"></i></a></li>
          </ul>
        </div>
        <div class="tm-downloads">
            <h3 class="uk-margin-top-remove uk-margin-small-bottom">Downloads</h3>
            <ul class="uk-list uk-margin-small-top">
                <li><a href="http://www.getbeans.io/download-beans/?no_cache=1" onclick="javascript:_paq.push(['trackEvent', 'Parent Theme', 'Download' '<?php echo $title; ?>']);" title="Download the Beans parent-theme'; ?>" data-uk-tooltip="{pos:'bottom-left'}">Beans Parent-Theme</a></li>
                <?php if ( $release_date != 'TBD' ) : ?>
                <li><a href="<?php echo $download_child; ?>" onclick="javascript:_paq.push(['trackEvent', 'Child Theme', 'Download' '<?php echo $title; ?>']);" title="Download tbr-<?php echo $lowercase_title . '-child.zip'; ?>" data-uk-tooltip="{pos:'bottom-left'}"><?php echo $title; ?> Child-Theme</a></li>
                <?php endif; ?>
                <li<?php if( $lowercase_title != 'voyager' ) : ?> class="tm-divider"<?php endif; ?>><a href="<?php echo $download_sketch; ?>" onclick="javascript:_paq.push(['trackEvent', 'Sketch Source', 'Download' '<?php echo $title; ?>']);" data-uk-tooltip="{pos:'bottom-left'}" title="Download <?php echo $lowercase_title . '-sketch.zip'; ?>"><?php echo $title; ?> Sketch Source</a></li>
                <?php if( $lowercase_title != 'voyager' ) : ?>
                <li class="uk-margin-top"><a class="tm-text-medium tm-github uk-button" title="View the <?php echo $title; ?> WordPress theme code on GitHub" href="https://github.com/ThemeButler/tbr-<?php echo $lowercase_title; ?>" target="_blank" data-uk-tooltip="{pos:'bottom-left'}"><i class="uk-icon-github uk-icon-small uk-margin-small-right"></i>View on GitHub</a></li>
                <?php endif; ?>
            </ul>
        </div>
      </div>
      <div class="tm-support">
        <h3 class="uk-margin-top-remove">Support</h3>
        <p>Since all our child-themes are free, support is not provided. There is a community forum and paid help available from Codeable.</p>
        <p class="tm-buttons-wrap"><a href="http://community.themebutler.com/t/<?php echo $lowercase_title; ?>" class="uk-margin-right uk-margin-bottom uk-button uk-button-secondary" target="_blank">Post on the Community Forum <i class="uk-icon-external-link uk-text-small"></i></a><span class="sep"> or </span>
            <a href="https://api.referoo.co/s/0gFdE" class="uk-margin-bottom uk-button uk-button-secondary" target="_blank">Get expert help on <span>Codeable</span> <i class="uk-icon-external-link uk-text-small"></i></a></p>
      </div>
    </div>
  </div>
<? }