Beispiel #1
0
                      </div>
                      <div class="entry-body">
                          <?php 
        if (is_sticky()) {
            ?>
                              <div class="featured-post"><span><?php 
            _e('Featured', 'iamd_text_domain');
            ?>
</span></div>
                              <div class="dt-sc-clear"></div>
                          <?php 
        }
        ?>
                          <?php 
        if (isset($meta_set['blog-post-excerpt']) != "") {
            echo dt_theme_excerpt($meta_set['blog-post-excerpt-length']);
        }
        ?>
                          <a href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('Read More', 'iamd_text_domain');
        ?>
 <i class="fa fa-angle-double-right"></i></a>
                      </div>
                  </div>
              </article>
          </div><?php 
    }
    echo '</div>';
Beispiel #2
0
 function widget($args, $instance)
 {
     extract($args);
     global $post;
     $title = empty($instance['title']) ? '' : strip_tags($instance['title']);
     $_post_count = (int) $instance['_post_count'];
     $_post_categories = "";
     if (!empty($instance['_post_categories'])) {
         $_post_categories = is_array($instance['_post_categories']) ? implode(",", $instance['_post_categories']) : $instance['_post_categories'];
     }
     $_enabled_image = isset($instance['_enabled_image']) ? $instance['_enabled_image'] : 0;
     $show_title = $instance['_excerpt'] == 'show title only' ? (bool) true : (bool) false;
     $arg = empty($_post_categories) ? "posts_per_page={$_post_count}" : "cat={$_post_categories}&posts_per_page={$_post_count}";
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo "<div class='recent-posts-widget'><ul>";
     $the_query = new WP_Query($arg);
     if ($the_query->have_posts()) {
         while ($the_query->have_posts()) {
             $the_query->the_post();
             $title = get_the_title();
             echo "<li>";
             if (1 == $_enabled_image) {
                 $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'my-post-thumb', false);
                 $image = $image != false ? $image[0] : "http://placehold.it/100x80";
                 echo "<a href='" . get_permalink() . "' class='thumb'>";
                 echo "<img src='{$image}' alt='{$title}'/>";
                 echo "</a>";
             }
             if ($show_title) {
                 echo "<h4><a href='" . get_permalink() . "'>{$title}</a></h4>";
             } else {
                 echo "<h4><a href='" . get_permalink() . "'>{$title}</a></h4>";
                 echo dt_theme_excerpt(7);
             }
             echo '<div class="entry-metadata">';
             echo '<p class="author"> <span class="fa fa-user"> </span> ' . __('Posted By: ', 'iamd_text_domain') . '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a></p>';
             $commtext = "";
             if (wp_count_comments($post->ID)->approved == 0) {
                 $commtext = '0';
             } else {
                 $commtext = wp_count_comments($post->ID)->approved;
             }
             echo '<p> <a href="' . get_permalink() . '/#comments"><span class="fa fa-comment"> </span>' . $commtext . '</a></p>';
             echo '</div>';
             echo "</li>";
         }
     } else {
         echo "<li><h4>" . __('No Posts found', 'iamd_text_domain') . "</h4></li>";
     }
     wp_reset_postdata();
     echo "</ul></div>";
     echo $after_widget;
 }
Beispiel #3
0
 function widget($args, $instance)
 {
     extract($args);
     global $post;
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $_post_count = (int) $instance['_post_count'];
     $_post_categories = "";
     if (!empty($instance['_post_categories']) && is_array($instance['_post_categories'])) {
         $_post_categories = array_filter($instance['_post_categories']);
     } elseif (!empty($instance['_post_categories'])) {
         $_post_categories = explode(",", $instance['_post_categories']);
     }
     $_enabled_image = isset($instance['_enabled_image']) ? $instance['_enabled_image'] : 0;
     $show_title = $instance['_excerpt'] == 'show title only' ? (bool) true : (bool) false;
     $arg = array('posts_per_page' => $_post_count, 'post_type' => 'dt_galleries');
     $arg = empty($_post_categories) ? $arg : array('posts_per_page' => $_post_count, 'tax_query' => array(array('taxonomy' => 'gallery_entries', 'field' => 'id', 'operator' => 'IN', 'terms' => $_post_categories)));
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo "<div class='recent-gallery-widget'><ul>";
     $the_query = new WP_Query($arg);
     if ($the_query->have_posts()) {
         while ($the_query->have_posts()) {
             $the_query->the_post();
             $title = strlen(get_the_title()) > 20 ? substr(get_the_title(), 0, 15) . "..." : get_the_title();
             echo "<li>";
             if (1 == $_enabled_image) {
                 $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'my-post-thumb', false);
                 $image = $image != false ? $image[0] : IAMD_BASE_URL . "/images/dummy-images/poster-my-post-thumb.jpg";
                 echo "<a href='" . get_permalink() . "' class='thumb'>";
                 echo "<img src='{$image}' alt='{$title}'/>";
                 echo "</a>";
             }
             if ($show_title) {
                 echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>";
             } else {
                 echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>";
                 echo dt_theme_excerpt();
             }
             echo "</li>";
         }
     } else {
         echo "<li>" . __('No Gallery Entries found', 'iamd_text_domain') . "</li>";
     }
     wp_reset_postdata();
     echo "</ul></div>";
     echo $after_widget;
 }
Beispiel #4
0
 function widget($args, $instance)
 {
     extract($args);
     global $post;
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $_post_count = (int) $instance['_post_count'];
     $_post_categories = "";
     if (!empty($instance['_post_categories']) && is_array($instance['_post_categories'])) {
         $_post_categories = array_filter($instance['_post_categories']);
     } elseif (!empty($instance['_post_categories'])) {
         $_post_categories = explode(",", $instance['_post_categories']);
     }
     $show_title = $instance['_excerpt'] == 'show title only' ? (bool) true : (bool) false;
     $arg = array('posts_per_page' => $_post_count, 'post_type' => 'dt_workouts');
     $arg = empty($_post_categories) ? $arg : array('posts_per_page' => $_post_count, 'tax_query' => array(array('taxonomy' => 'workout_entries', 'field' => 'id', 'operator' => 'IN', 'terms' => $_post_categories)));
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     echo "<div class='recent-workout-widget'>";
     $the_query = new WP_Query($arg);
     if ($the_query->have_posts()) {
         while ($the_query->have_posts()) {
             $the_query->the_post();
             $title = strlen(get_the_title()) > 25 ? substr(get_the_title(), 0, 20) . "..." : get_the_title();
             echo '<div class="dt-excersise-entry">';
             echo "<div class='dt-excersise-title title'>";
             $wmeta = get_post_meta(get_the_id(), '_workout_settings', true);
             if (!empty($wmeta['nosteps'])) {
                 echo '<p class="count">';
                 echo "<a href='javascript:void(0)'>" . $wmeta['nosteps'] . " <br><span>" . __('Steps', 'iamd_text_domain') . "</span></a>";
                 echo '</p>';
             } else {
                 $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'my-post-thumb', false);
                 $image = $image != false ? $image[0] : "http://placehold.it/100x80";
                 echo "<a href='" . get_permalink() . "' class='thumb'>";
                 echo "<img src='{$image}' alt='{$title}'/>";
                 echo "</a>";
             }
             echo "<h5><a href='" . get_permalink() . "'>{$title}</a></h5>";
             echo "</div>";
             if (!$show_title) {
                 echo dt_theme_excerpt();
             }
             echo '</div>';
         }
     } else {
         echo "<p>" . __('No Workouts found', 'iamd_text_domain') . "</p>";
     }
     wp_reset_postdata();
     echo "</div>";
     echo $after_widget;
 }