示例#1
0
function latte_post_format_tools_aside_infinity($content)
{
    if (has_post_format('aside') && !is_singular()) {
        $content .= ' <a class="permalink" href="' . get_permalink() . '" title="' . the_title_attribute(array('echo' => false)) . '">&#8734;</a>';
    }
    return $content;
}
示例#2
0
 /**
  * Display widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, $this->defaults);
     $featured_page = new WP_Query(array('page_id' => $instance['page_id']));
     echo $before_widget . '<div class="feature-page">';
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     if ($featured_page->have_posts()) {
         while ($featured_page->have_posts()) {
             $featured_page->the_post();
             echo '<div class="' . implode(' ', get_post_class()) . '">';
             if (!empty($instance['show_title'])) {
                 printf('<h4 class="entry-title"><a href="%s" title="%s">%s</a></h4>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
             }
             //Show image
             if (!empty($instance['show_image'])) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
             }
             if (!empty($instance['show_content'])) {
                 if (empty($instance['content_limit'])) {
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
             }
             echo '</div><!--end post_class()-->' . "\n\n";
         }
     }
     echo '</div>' . $after_widget;
     wp_reset_query();
 }
示例#3
0
    function woo_widget_tabs_latest($posts = 5, $size = 45)
    {
        global $post;
        $latest = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'numberposts' => $posts));
        foreach ($latest as $post) {
            setup_postdata($post);
            ?>
			<li>
				<?php 
            if ($size != 0) {
                woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true');
            }
            ?>
				<a title="<?php 
            the_title_attribute();
            ?>
" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
				<span class="meta"><?php 
            the_time(get_option('date_format'));
            ?>
</span>
				<div class="fix"></div>
			</li>
		<?php 
        }
        wp_reset_postdata();
    }
示例#4
0
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @since 1.0
 * @global $mashsb_options
 * @global $post
 * @return void
 * @param string $hook Page hook
 */
function mashsb_load_scripts($hook)
{
    global $wp;
    if (!apply_filters('mashsb_load_scripts', mashsbGetActiveStatus(), $hook)) {
        mashdebug()->info("mashsb_load_script not active");
        return;
    }
    global $mashsb_options, $post;
    $url = get_permalink($post->ID);
    $title = urlencode(html_entity_decode(the_title_attribute('echo=0'), ENT_COMPAT, 'UTF-8'));
    $title = str_replace('#', '%23', $title);
    $titleclean = esc_html($title);
    $image = mashsb_get_image($post->ID);
    $desc = mashsb_get_excerpt_by_id($post->ID);
    /* Load hashshags */
    $hashtag = !empty($mashsb_options['mashsharer_hashtag']) ? $mashsb_options['mashsharer_hashtag'] : '';
    $js_dir = MASHSB_PLUGIN_URL . 'assets/js/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = mashsbIsDebugMode() ? '' : '.min';
    //$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
    isset($mashsb_options['load_scripts_footer']) ? $in_footer = true : ($in_footer = false);
    wp_enqueue_script('mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer);
    !isset($mashsb_options['disable_sharecount']) ? $shareresult = getSharedcount($url) : ($shareresult = 0);
    wp_localize_script('mashsb', 'mashsb', array('shares' => $shareresult, 'round_shares' => isset($mashsb_options['mashsharer_round']), 'animate_shares' => isset($mashsb_options['animate_shares']) && is_singular() ? 1 : 0, 'share_url' => $url, 'title' => $titleclean, 'image' => $image, 'desc' => $desc, 'hashtag' => $hashtag, 'subscribe' => !empty($mashsb_options['subscribe_behavior']) && $mashsb_options['subscribe_behavior'] === 'content' ? 'content' : 'link', 'subscribe_url' => isset($mashsb_options['subscribe_link']) ? $mashsb_options['subscribe_link'] : '', 'activestatus' => mashsbGetActiveStatus(), 'singular' => is_singular() ? 1 : 0, 'twitter_popup' => isset($mashsb_options['twitter_popup']) ? 0 : 1));
}
示例#5
0
 /**
  * @param $type
  *
  * @return string|void
  */
 public function get_seo_plugin_datas($type)
 {
     $aioseop_title = get_post_meta($this->post_ID, '_aioseop_title', true);
     $aioseop_description = get_post_meta($this->post_ID, '_aioseop_description', true);
     $yoast_wpseo_title = get_post_meta($this->post_ID, '_yoast_wpseo_title', true);
     $yoast_wpseo_description = get_post_meta($this->post_ID, '_yoast_wpseo_metadesc', true);
     $title = get_the_title($this->post_ID);
     $desc = Utilities::get_excerpt_by_id($this->post_ID);
     if (class_exists('WPSEO_Frontend')) {
         $title = !empty($yoast_wpseo_title) ? htmlspecialchars(stripcslashes($yoast_wpseo_title)) : get_the_title($this->post_ID);
         $desc = !empty($yoast_wpseo_description) ? htmlspecialchars(stripcslashes($yoast_wpseo_description)) : Utilities::get_excerpt_by_id($this->post_ID);
     } elseif (class_exists('All_in_One_SEO_Pack')) {
         $title = !empty($aioseop_title) ? htmlspecialchars(stripcslashes($aioseop_title)) : the_title_attribute(array('echo' => false));
         $desc = !empty($aioseop_description) ? htmlspecialchars(stripcslashes($aioseop_description)) : Utilities::get_excerpt_by_id($this->post_ID);
     }
     switch ($type) {
         case 'title':
             return $title;
             break;
         case 'desc':
             return $desc;
             break;
         default:
             return $title;
     }
 }
function load_5speed_archive()
{
    echo "<h3 class=\"list-title\">My list of reasons why I drive a manual transmission car:</h3>";
    echo "<div class=\"5speed\">";
    while (have_posts()) {
        the_post();
        ?>
        <li>
            <h3 style="margin-bottom:0px;"># <a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="Reason <?php 
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h3>
            <?php 
        the_content();
        ?>
        </li>
    <?php 
    }
    echo "</div>";
}
示例#7
0
 function tb_ad_featured_thumbnail()
 {
     global $post;
     // go see if any images are associated with the ad
     $image_id = cp_get_featured_image_id($post->ID);
     // set the class based on if the hover preview option is set to "yes"
     if (get_option('cp_ad_image_preview') == 'yes') {
         $prevclass = 'preview';
     } else {
         $prevclass = 'nopreview';
     }
     if ($image_id > 0) {
         // get 50x50 v3.0.5+ image size
         $adthumbarray = wp_get_attachment_image($image_id, 'ad-small');
         // grab the large image for onhover preview
         $adlargearray = wp_get_attachment_image_src($image_id, 'large');
         $img_large_url_raw = $adlargearray[0];
         // must be a v3.0.5+ created ad
         if ($adthumbarray) {
             echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumbarray . '</a>';
             // maybe a v3.0 legacy ad
         } else {
             $adthumblegarray = wp_get_attachment_image_src($image_id, 'ad-small');
             $img_thumbleg_url_raw = $adthumblegarray[0];
             echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumblegarray . '</a>';
         }
         // no image so return the placeholder thumbnail
     } else {
         echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"><img class="attachment-sidebar-thumbnail" alt="" title="" src="' . get_stylesheet_directory_uri() . '/images/no-thumb-100.jpg" /></a>';
     }
 }
示例#8
0
function twentyten_posted_in()
{
    // Retrieves tag list of current post, separated by commas.
    $tag_list = get_the_tag_list('', ', ');
    $temp_tag_array = explode(', ', $tag_list);
    $buf_tag_list = array();
    foreach ($temp_tag_array as $temp_tag) {
        if (strpos($temp_tag, "html") > 0) {
            $buf_tag_list[] = '<div class="html">' . $temp_tag . '</div>';
        } elseif (strpos($temp_tag, "css") > 0) {
            $buf_tag_list[] = '<div class="css">' . $temp_tag . '</div>';
        } elseif (strpos($temp_tag, "jquery") > 0) {
            $buf_tag_list[] = '<div class="jquery">' . $temp_tag . '</div>';
        } elseif (strpos($temp_tag, "Javascript") > 0) {
            $buf_tag_list[] = '<div class="Javascript">' . $temp_tag . '</div>';
        } elseif (strpos($temp_tag, "wordpress") > 0) {
            $buf_tag_list[] = '<div class="wordpress">' . $temp_tag . '</div>';
        } else {
            $buf_tag_list[] = $temp_tag;
        }
    }
    $tag_list = implode(', ', $buf_tag_list);
    if ($tag_list) {
        $posted_in = __('This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
    } elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
        $posted_in = __('This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
    } else {
        $posted_in = __('Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
    }
    // Prints the string, replacing the placeholders.
    printf($posted_in, get_the_category_list(', '), $tag_list, get_permalink(), the_title_attribute('echo=0'));
}
示例#9
0
 public static function featured_image($post_ID, $size = 'full', $class_array = [], $include_caption = false)
 {
     $class_array[] = 'img-responsive';
     // For Bootstrap responsive images
     $class = implode(' ', $class_array);
     // Ensure that all images are responsive
     if (has_post_thumbnail($post_ID)) {
         /* get the title attribute of the post or page
          * and apply it to the alt tag of the image if the alt tag is empty
          */
         $attachment_id = get_post_thumbnail_id($post_ID);
         // if no alt attribute is filled out then echo "Featured Image of article: Article Name"
         if ('' === get_post_meta($attachment_id, '_wp_attachment_image_alt', true)) {
             $alt = the_title_attribute(array('before' => __('Featured image of article: ', 'castleview'), 'echo' => false));
         } else {
             $alt = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
         }
         // Get the title attribute for the featured image
         $title = get_the_title($attachment_id);
         // Get the Image Caption
         $caption = get_post($attachment_id)->post_excerpt;
         $default_attr = array('class' => $class, 'alt' => $alt, 'title' => $title);
         if (false === $include_caption) {
             return get_the_post_thumbnail($post_ID, $size, $default_attr);
         }
         if (true === $include_caption) {
             return ['image' => get_the_post_thumbnail($post_ID, $size, $default_attr), 'caption' => $caption];
         }
     }
 }
示例#10
0
/**
 * Prints the attached image with a link to the next attached image.
 */
function cw_magazine_the_attached_image()
{
    $post = get_post();
    $attachment_size = apply_filters('underscore_attachment_size', array(1200, 1200));
    $next_attachment_url = wp_get_attachment_url();
    /**
     * Grab the IDs of all the image attachments in a gallery so we can get the
     * URL of the next adjacent image in a gallery, or the first image (if
     * we're looking at the last image in a gallery), or, in a gallery of one,
     * just the link to that image file.
     */
    $attachment_ids = get_posts(array('post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
    // If there is more than 1 attachment in a gallery...
    if (count($attachment_ids) > 1) {
        foreach ($attachment_ids as $attachment_id) {
            if ($attachment_id == $post->ID) {
                $next_id = current($attachment_ids);
                break;
            }
        }
        // get the URL of the next image attachment...
        if ($next_id) {
            $next_attachment_url = get_attachment_link($next_id);
        } else {
            $next_attachment_url = get_attachment_link(array_shift($attachment_ids));
        }
    }
    printf('<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>', esc_url($next_attachment_url), the_title_attribute(array('echo' => false)), wp_get_attachment_image($post->ID, $attachment_size));
}
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function printWidget($args, $instance)
    {
        // Get URL
        global $wp;
        $url = add_query_arg($wp->query_string, '', home_url($wp->request));
        $title = the_title_attribute(['echo' => 0]) . ' from ' . get_bloginfo('name');
        // Get meta information
        $desc = \Proud\Core\wp_trim_excerpt('', false, true);
        ?>
    <!--<div class="dropdown share">-->
      <a href="#" id="share-dropdown" data-toggle="dropdown"><i class="fa fa-fw fa-share-alt"></i>Share <!--<span class="caret"></span>--></a>
      <ul class="dropdown-menu" aria-labelledby="share-dropdown">
        <li><a href="https://www.facebook.com/sharer/sharer.php" target="_blank"><i class="fa fa-facebook-square fa-fw"></i> Facebook</a></li>
        <li><a href="http://twitter.com/share"><i class="fa fa-twitter-square fa-fw"></i> Twitter</a></li>
        <li><a href="mailto:?subject=<?php 
        print urlencode($title);
        ?>
&body=Read more: <?php 
        print urlencode($url);
        ?>
"><i class="fa fa-envelope fa-fw"></i> Email</a>
      </ul>
    <!--</div>-->
    <?php 
    }
示例#12
0
/**
 * Post header
 * in format-standard
 * 
 * @since 1.0.0
 */
function reactor_do_standard_header_titles()
{
    if (!is_single() && get_post_meta(get_the_ID(), '_amaga_titol', true) == "on") {
        edit_post_link(__('Edit'), '<div class="edit-link"><span>', '</span></div>');
        return;
    }
    if (is_single()) {
        ?>
                    <h1 class="entry-title"><?php 
        the_title();
        ?>
</h1>
<?php 
    } else {
        ?>
                    <h2 class="entry-title"><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        echo esc_attr(sprintf(__('%s', 'reactor'), the_title_attribute('echo=0')));
        ?>
" rel="bookmark"><?php 
        the_title();
        ?>
</a></h2>
<?php 
    }
    edit_post_link(__('Edit'), '<div class="edit-link"><span>', '</span></div>');
}
示例#13
0
function depo_about_widget()
{
    ?>
	<li id="depo_about">
		<?php 
    query_posts('pagename=about');
    ?>
		<?php 
    while (have_posts()) {
        the_post();
        ?>
				<h2><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="<?php 
        printf(__('Permanent Link to %s', 'depo-masthead'), the_title_attribute('echo=0'));
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
				<div class="entry">
					<?php 
        continue_reading_excerpt();
        ?>
				</div>
		<?php 
    }
    ?>
	</li>
	<?php 
}
示例#14
0
function post_format_image_featured()
{
    if (has_post_format('image') && has_post_thumbnail() && is_singular('post')) {
        $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'post-image')));
        printf('<a href="%s" id="featured-post-image" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
    }
}
示例#15
0
function ipin_opengraph()
{
    if (is_single()) {
        global $post;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', the_title_attribute('echo=0')) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
        $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
    if (is_tax('board')) {
        global $post, $wp_query;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . $wp_query->queried_object->name . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/board/') . $wp_query->queried_object->term_id . '/" />' . "\n";
        $output .= '<meta property="og:description" content="" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
}
/**
 * 2.0 Slider
 *
 * @since dreamer 1.0
 */
function dreamer_responsive_slider($atts)
{
    $slides = new WP_Query(array('orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'slides'));
    $slider = '<div class="responsive-slider flexslider"><ul class="slides">';
    if ($slides->have_posts()) {
        while ($slides->have_posts()) {
            $slides->the_post();
            $slider .= '<li><div id="slide-' . get_the_ID() . '" class="slide">';
            global $post;
            if (has_post_thumbnail()) {
                if (get_post_meta($post->ID, "_slide_link_url", true)) {
                    $slider .= '<a href="' . get_post_meta($post->ID, "_slide_link_url", true) . '" title="' . the_title_attribute(array('echo' => 0)) . '" >';
                }
                $slider .= get_the_post_thumbnail($post->ID, 'slide-thumbnail', array('class' => 'slide-thumbnail'));
                if (get_post_meta($post->ID, "_slide_link_url", true)) {
                    $slider .= '</a>';
                }
            }
            $slider .= '<h5 class="slide-title"><a href="' . get_post_meta($post->ID, "_slide_link_url", true) . '" title="' . the_title_attribute(array('echo' => 0)) . '" >' . get_the_title() . '</a></h5>';
            $slider .= '</div></li>';
        }
        wp_reset_query();
        return $slider . '</ul></div>';
    }
}
示例#17
0
    /**
     * Displays an optional post thumbnail.
     *
     * Wraps the post thumbnail in an anchor element on index views, or a div
     * element when on single views.
     *
     * Create your own twentysixteen_post_thumbnail() function to override in a child theme.
     *
     * @since Twenty Sixteen 1.0
     */
    function twentysixteen_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_singular()) {
            ?>

	<div class="post-thumbnail">
		<?php 
            the_post_thumbnail();
            ?>
	</div><!-- .post-thumbnail -->

	<?php 
        } else {
            ?>

	<a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
" aria-hidden="true">
		<?php 
            the_post_thumbnail('post-thumbnail', array('alt' => the_title_attribute('echo=0')));
            ?>
	</a>

	<?php 
        }
        // End is_singular()
    }
示例#18
0
    function creative_blog_breaking_news()
    {
        $get_featured_posts = new WP_Query(array('posts_per_page' => 5, 'post_type' => 'post', 'ignore_sticky_posts' => true));
        ?>
        <div class="breaking-news">
            <strong class="breaking-news-latest"><?php 
        esc_html_e('Latest:', 'creative-blog');
        ?>
</strong>
            <ul class="newsticker">
                <?php 
        while ($get_featured_posts->have_posts()) {
            $get_featured_posts->the_post();
            ?>
                    <li>
                        <a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title_attribute();
            ?>
"><?php 
            the_title();
            ?>
</a>
                    </li>
                <?php 
        }
        ?>
            </ul>
        </div>
        <?php 
        // Reset Post Data
        wp_reset_query();
    }
示例#19
0
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @since 1.0
 * @global $mashsb_options
 * @global $post
 * @return void
 * @param string $hook Page hook
 */
function mashsb_load_scripts($hook)
{
    global $mashsb_options, $post, $mashsb_sharecount;
    if (!apply_filters('mashsb_load_scripts', mashsbGetActiveStatus(), $hook)) {
        mashdebug()->info("mashsb_load_script not active");
        return;
    }
    $url = mashsb_get_url();
    $title = urlencode(html_entity_decode(the_title_attribute('echo=0'), ENT_COMPAT, 'UTF-8'));
    $title = str_replace('#', '%23', $title);
    $titleclean = esc_html($title);
    $image = "";
    $desc = "";
    if (isset($post->ID)) {
        $image = mashsb_get_image($post->ID);
        $desc = mashsb_get_excerpt_by_id($post->ID);
    }
    // Rest API Not used any longer
    //$restapi = mashsb_allow_rest_api() ? "1" : "0";
    /* Load hashshags */
    $hashtag = !empty($mashsb_options['mashsharer_hashtag']) ? $mashsb_options['mashsharer_hashtag'] : '';
    $js_dir = MASHSB_PLUGIN_URL . 'assets/js/';
    // Use minified libraries if Mashshare debug mode is turned off
    $suffix = mashsbIsDebugMode() ? '' : '.min';
    isset($mashsb_options['load_scripts_footer']) ? $in_footer = true : ($in_footer = false);
    wp_enqueue_script('mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer);
    //wp_enqueue_script( 'element-queries', $js_dir . 'ElementQueries' . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
    //wp_enqueue_script( 'resize-sensor', $js_dir . 'ResizeSensor' . '.js', array('jquery'), MASHSB_VERSION, $in_footer );
    !isset($mashsb_options['disable_sharecount']) ? $shareresult = getSharedcount($url) : ($shareresult = 0);
    wp_localize_script('mashsb', 'mashsb', array('shares' => $shareresult, 'round_shares' => isset($mashsb_options['mashsharer_round']), 'animate_shares' => isset($mashsb_options['animate_shares']) && is_singular() ? 1 : 0, 'dynamic_buttons' => isset($mashsb_options['dynamic_button_resize']) ? 1 : 0, 'share_url' => $url, 'title' => $titleclean, 'image' => $image, 'desc' => $desc, 'hashtag' => $hashtag, 'subscribe' => !empty($mashsb_options['subscribe_behavior']) && $mashsb_options['subscribe_behavior'] === 'content' ? 'content' : 'link', 'subscribe_url' => isset($mashsb_options['subscribe_link']) ? $mashsb_options['subscribe_link'] : '', 'activestatus' => mashsbGetActiveStatus(), 'singular' => is_singular() ? 1 : 0, 'twitter_popup' => isset($mashsb_options['twitter_popup']) ? 0 : 1, 'refresh' => mashsb_is_cache_refresh() ? 1 : 0));
}
示例#20
0
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     $num_list = apply_filters('widget_num_list', $instance['num_list']);
     echo '<div class="panel panel-default widget_portfolio">';
     echo $args['before_widget'];
     if (!empty($title)) {
         echo '<div class="panel-heading"><h4>' . $title . '</h4></div>';
     }
     $type_port = 'portfolios';
     $args_portt = array('post_type' => $type_port, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => $num_list);
     $my_query = null;
     $my_query = new WP_Query($args_portt);
     if ($my_query->have_posts()) {
         echo '<div class="panel-body">';
         while ($my_query->have_posts()) {
             $my_query->the_post();
             echo '<a href="';
             the_permalink();
             echo '" title="Permanent Link to';
             the_title_attribute();
             echo '">';
             echo get_the_post_thumbnail($page->ID, 'thumbnail', array('class' => 'img-responsive'));
             the_title();
             echo '</a>';
         }
         echo '<hr></div>';
     }
     echo '</div>';
     echo $args['after_widget'];
 }
示例#21
0
 function x_featured_image($cropped = '')
 {
     $stack = x_get_stack();
     $fullwidth = in_array('x-full-width-active', get_body_class()) ? true : false;
     if (has_post_thumbnail()) {
         if ($cropped == 'cropped') {
             if ($fullwidth) {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-cropped-fullwidth', NULL);
             } else {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-cropped', NULL);
             }
         } else {
             if ($fullwidth) {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack . '-fullwidth', NULL);
             } else {
                 $thumb = get_the_post_thumbnail(NULL, 'entry-' . $stack, NULL);
             }
         }
         switch (is_singular()) {
             case true:
                 printf('<div class="entry-thumb">%s</div>', $thumb);
                 break;
             case false:
                 printf('<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>', esc_url(get_permalink()), esc_attr(sprintf(__('Permalink to: "%s"', '__x__'), the_title_attribute('echo=0'))), $thumb);
                 break;
         }
     }
 }
示例#22
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $postcount = empty($instance['postcount']) ? '5' : $instance['postcount'];
        $offset = empty($instance['offset']) ? '' : $instance['offset'];
        $sticky = isset($instance['sticky']) ? $instance['sticky'] : 0;
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . esc_attr($title) . $after_title;
        }
        $args = array('posts_per_page' => $postcount, 'offset' => $offset, 'ignore_sticky_posts' => $sticky);
        $widget_loop = new WP_Query($args);
        ?>
		<ul class="mh-rp-widget widget-list"><?php 
        while ($widget_loop->have_posts()) {
            $widget_loop->the_post();
            ?>
				<li class="rp-widget-item"><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title_attribute();
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a></li><?php 
        }
        wp_reset_postdata();
        ?>
		</ul><?php 
        echo $after_widget;
    }
示例#23
0
function samfujera_home_featured_image()
{
    // display the featured image for the front page. Large, please.
    global $post;
    $image = get_the_post_thumbnail($post->ID, 'original', array('alt' => the_title_attribute('echo=0'), 'title' => the_title_attribute('echo=0')));
    echo $image;
}
/**
 * Created by PhpStorm.
 * User: cleavesp
 * Date: 3/30/15
 * Time: 3:13 PM
 */
function ms_format_content_item_html($post_id)
{
    $output = '<li class=\'article-item clear\'>';
    if (has_post_thumbnail()) {
        $output .= '<a class=\'alignleft\' href=\'' . the_permalink() . '\' title=\'' . the_title_attribute() . '\'>';
        $output .= get_the_post_thumbnail($post_id);
    }
    $output .= '<div class=\'article-body\'><h3><a href=\'' . the_permalink() . '\'>' . the_title() . '</a></h3>';
    $output .= '<p class=\'entry-content\'>';
    $trimmed_content = wp_trim_words(get_the_content(), 18, '<a class=\'read-more\' href=\'' . get_permalink() . '\'>... Read More</a>');
    $output .= $trimmed_content;
    $output .= '</p>';
    if (get_post_meta(get_the_ID(), 'sourcePub', true)) {
        $output .= '<div class=\'source-flag\'>';
        $output .= '<a href=\'' . get_post_meta(get_the_ID(), 'originUrl', true) . '\'></a></div>';
        $sourcePub = get_post_meta(get_the_ID(), 'sourcePub', true);
        if ($sourcePub === 'WSJ') {
            $output .= '<img src=\'' . get_bloginfo('template_directory') . '/img/wsj_logo.png' . '\' alt=\'Source Logo\' />';
        } elseif ($sourcePub === 'NEWSAUS') {
            $output .= '<img src=\'' . get_bloginfo('template_directory') . '/img/newsaus_logo.png' . '\' alt=\'Source Logo\' />';
        } elseif ($sourcePub === 'NEWSUK') {
            $output .= '<img src=\'' . get_bloginfo('template_directory') . '/img/newsuk_logo.png' . '\' alt=\'Source Logo\' />';
        } elseif ($sourcePub === 'NYPOST') {
            $output .= '<img src=\'' . get_bloginfo('template_directory') . '/img/nypost_logo.png' . '\' alt=\'Source Logo\' />';
        }
    }
    $output .= '</li>';
    return $output;
}
示例#25
0
        function categori_news(){
            query_posts('cat=9&showposts=10&posts_per_page=3');

            while (have_posts()) : the_post();
                /*Dima insert*/the_excerpt(); ?>
                <div class="content-box">
                    <div class="bgr01"><div class="bgr02"><div class="bgr03">
                                <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
                                    <div class="title">
                                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                        <div class="date_all">
                                            <?php the_time('l, j ?F, Y') ?>
                                        </div>
                                        <div class="post">
                                            Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
                                        </div>
                                    </div>
                                    <div class="content_box">
                                        <?php the_content('Читать всё'); ?>
                                    </div>

                                    <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>

                                    <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
                                    <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
                                </div>
                            </div></div></div>
                </div>
            <?php endwhile;}
示例#26
0
function share_this_shortcode($atts)
{
    ob_start();
    ?>
	<small><b>Share this post</b></small><br>
	<a class='st_twitter_custom' href="http://twitter.com/intent/tweet?status=<?php 
    the_title_attribute();
    ?>
+<?php 
    the_permalink();
    ?>
" target="_blank"></a>
	<a class='st_facebook_custom' href="http://www.facebook.com/sharer/sharer.php?u=<?php 
    the_permalink();
    ?>
&title=<?php 
    the_title_attribute();
    ?>
" target="_blank"></a>
	<a class='st_linkedin_custom' href="http://www.linkedin.com/shareArticle?mini=true&url=<?php 
    the_permalink();
    ?>
&title=<?php 
    the_title_attribute();
    ?>
&source=http://startupbritain.org" target="_blank"></a>
	<a class='st_googleplus_custom' href="https://plus.google.com/share?url=<?php 
    the_permalink();
    ?>
" target="_blank"></a>
	<?php 
    $myvariable = ob_get_clean();
    return $myvariable;
}
示例#27
0
function blog_summary_shortcode($attr)
{
    // Describes what attributes to parse from shortcode; only 'count'
    extract(shortcode_atts(array('count' => '5', 'grouptag' => 'ul', 'entrytag' => 'li', 'titletag' => 'h4', 'datetag' => 'span', 'commentstag' => 'span', 'summarytag' => 'div'), $attr));
    // Queries to populate our loop based on shortcode count attribute
    $r = new WP_Query("showposts={$count}&what_to_show=posts&nopaging=0&post_status=publish");
    // Only run if we have posts; can't run this through searches
    if ($r->have_posts() && !is_search()) {
        // If we're using a Sandbox-friendly theme . . .
        if (function_exists('sandbox_body_class')) {
            // We can't have double hfeed classes, otherwise it won't parse
            $groupclasses = 'xoxo';
        } else {
            // Otherwise, use hfeed to ensure hAtom compliance
            $groupclasses = 'xoxo hfeed';
        }
        // Begin the output for shortcode and inserts in the group tag what classes we have
        $output = '<' . $grouptag . ' class="' . $groupclasses . '">';
        // Begins our loop for returning posts
        while ($r->have_posts()) {
            // Sets which post from our loop we're at
            $r->the_post();
            // Allows the_date() with multiple posts within a single day
            unset($previousday);
            // If we're using a Sandbox-friendly theme . . .
            if (function_exists('sandbox_post_class')) {
                // Let's use semantic classes with each entry element
                $entryclasses = sandbox_post_class(false);
            } else {
                // Otherwise, use hentry to ensure hAtom compliance
                $entryclasses = 'hentry';
            }
            // Begin entry wrapper and inserts what classes we got from above
            $output .= "\n" . '<' . $entrytag . ' class="' . $entryclasses . '">';
            // Post title
            $output .= "\n" . '<' . $titletag . ' class="entry-title"><a href="' . get_permalink() . '" title="' . sprintf(__('Permalink to %s', 'blog_summary'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a></' . $titletag . '>';
            // Post date with hAtom support
            $output .= "\n" . '<' . $datetag . ' class="entry-date"><abbr class="published" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . sprintf(__('%s', 'blog_summary'), the_date('', '', '', false)) . '</abbr></' . $datetag . '>';
            // Comments number
            $output .= "\n" . '<' . $commentstag . ' class="entry-comments"><a href="' . get_permalink() . '#comments" title="' . sprintf(__('Comments to %s', 'blog_summary'), the_title_attribute('echo=0')) . '">' . sprintf(__('Comments (%s)', 'blog_summary'), apply_filters('comments_number', get_comments_number())) . '</a></' . $commentstag . '>';
            // Post excerpt with hAtom support
            $output .= "\n" . '<' . $summarytag . ' class="entry-summary">' . "\n" . apply_filters('the_excerpt', get_the_excerpt()) . '</' . $summarytag . '>';
            // Close each post LI
            $output .= "\n" . '</' . $entrytag . '>';
            // Finish the have_posts() query
        }
        // while ( $r->have_posts() ) :
        // Close the parent UL
        $output .= "\n" . '</' . $grouptag . '>';
        // Rewinds loop from $r->the_post();
        rewind_posts();
        // End the initial IF statement
    }
    // if ( $r->have_posts() ) :
    // Clears our query to put the loop back where it was
    wp_reset_query();
    // $r = new WP_Query()
    // Returns $output to the shortcode
    return $output;
}
示例#28
0
文件: widget.php 项目: besimhu/legacy
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $post_type = $instance['post_type'];
        $link_text = $instance['link_text'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        query_posts(array('post_type' => $post_type, 'showposts' => 1));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $content = substr(get_the_content(), 0, 100);
                the_title('<h4>', '</h4>');
                the_excerpt();
                ?>
<a href="<?php 
                the_permalink();
                ?>
" class="btn_Select" title="<?php 
                the_title_attribute();
                ?>
"><span><?php 
                echo $link_text;
                ?>
</span><strong>&gt;</strong></a><?php 
            }
        } else {
            _e('Sorry, no posts matched your criteria.');
        }
        wp_reset_query();
        echo $after_widget;
    }
示例#29
0
function ipin_head()
{
    //Opengraph
    if (is_single()) {
        global $post;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', mb_strimwidth(the_title_attribute('echo=0'), 0, 255, ' ...')) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
        if ($post->post_content == '') {
            $meta_categories = get_the_category($post->ID);
            foreach ($meta_categories as $meta_category) {
                $meta_category_name = $meta_category->name;
            }
            if (ipin_get_post_board()) {
                $meta_board_name = ipin_get_post_board()->name;
            } else {
                $meta_board_name = __('Untitled', ipin);
            }
            $output .= '<meta property="og:description" content="' . esc_attr(__('Pinned onto', 'ipin') . ' ' . $meta_board_name . ' ' . __('Board in', 'ipin') . ' ' . $meta_category_name . ' ' . __('Category', 'ipin')) . '" />' . "\n";
        } else {
            $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
        }
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        if (get_option('wsl_settings_Facebook_app_id')) {
            $output .= '<meta property="fb:app_id" content="' . get_option('wsl_settings_Facebook_app_id') . '" />' . "\n";
        }
        echo $output;
    }
    if (is_tax('board')) {
        global $post, $wp_query, $wp_taxonomies;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . esc_attr($wp_query->queried_object->name) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/' . $wp_taxonomies["board"]->rewrite['slug'] . '/' . sanitize_title($wp_query->queried_object->name, '_') . '/') . $wp_query->queried_object->term_id . '/" />' . "\n";
        $output .= '<meta property="og:description" content="" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
    if (is_author()) {
        global $wp_query, $wp_rewrite;
        $user_info = get_user_by('id', $wp_query->query_vars['author']);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . esc_attr($user_info->display_name) . ' (' . $user_info->user_nicename . ')" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/') . $wp_rewrite->author_base . '/' . $user_info->user_nicename . '/" />' . "\n";
        $output .= '<meta property="og:description" content="' . esc_attr($user_info->description) . '" />' . "\n";
        $avatar_id = get_user_meta($user_info->ID, 'ipin_user_avatar', true);
        if ($avatar_id != '' && $avatar_id != 'deleted') {
            $user_avatar = wp_get_attachment_image_src($avatar_id, 'full');
            $output .= '<meta property="og:image" content="' . $user_avatar[0] . '" />' . "\n";
        }
        echo $output;
    }
}
/**
 * Output the image
 * We're only going to link the image if there's something to link to
 */
function rmb_add_image()
{
    $imageclass = 'alignright member-single-image';
    if ($image = genesis_get_image('format=url&size=member-image')) {
        printf('<div class="portfolio-image"><img class="%s" src="%s" alt="%s" /></div>', $imageclass, $image, the_title_attribute('echo=0'));
    }
}