/** @see WP_Widget::widget */ function widget($args, $instance) { $args['id'] = isset($args['id']) ? $args['id'] : 'I4Web_LMS_Announcements_Widget'; $instance['title'] = isset($instance['title']) ? $instance['title'] : ''; $title = $instance['title']; echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } // Start the query for the latest 3 posts $args = array('post_type' => array('post'), 'posts_per_page' => 3); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); echo '<ul class="announcements-list no-bullet">'; if (has_post_thumbnail()) { echo '<li><span class="announcement-feat-img">' . get_the_post_thumbnail($post_id, array(100, 100)) . '</span><a href="' . get_the_permalink() . '">' . get_the_title() . '</a>'; } else { echo '<li><a href="' . get_the_permalink() . '">' . get_the_title() . '</a>'; } echo '<p>' . i4_lms_posted_on() . '</p> </li> </ul>'; } $posts_page = get_option('page_for_posts'); //Get the ID of the page set as the Posts Page echo '<a href="' . get_permalink($posts_page) . '" class="button expand">Read All</a>'; wp_reset_postdata(); } else { echo '<p>Sorry, there are no announcements available at this time</p>'; } echo $args['after_widget']; }
/** * Social Media Share Shortcode * * @global class $post * * @param array $atts * @param string $content * @return string $output */ function rt_social_media_share($atts = array(), $content = null) { global $post; //Available Social Media Icons $rt_social_share_list = apply_filters("rt_social_media_list", array("Email" => array("icon_name" => "mail", "url" => "mailto:?body=[URL]", "popup" => false), "Twitter" => array("icon_name" => "twitter", "url" => "http://twitter.com/home?status=[TITLE]+[URL]", "popup" => true), "Facebook" => array("icon_name" => "facebook", "url" => "http://www.facebook.com/sharer/sharer.php?u=[URL]&title=[TITLE]", "popup" => true), "Google +" => array("icon_name" => "gplus", "url" => "https://plus.google.com/share?url=[URL]", "popup" => true), "Pinterest" => array("icon_name" => "pinterest", "url" => "http://pinterest.com/pin/create/bookmarklet/?media=[MEDIA]&url=[URL]&is_video=false&description=[TITLE]", "popup" => true), "Tumblr" => array("icon_name" => "tumblr", "url" => "http://tumblr.com/share?url=[URL]&title=[TITLE]", "popup" => true), "Linkedin" => array("icon_name" => "linkedin", "url" => "http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=", "popup" => true), "Vkontakte" => array("icon_name" => "vkontakte", "url" => "http://vkontakte.ru/share.php?url=[URL]", "popup" => true))); $title = urlencode(get_the_title($post->ID)); $permalink = urlencode(get_the_permalink($post->ID)); $image = urlencode(rt_get_attachment_image_src(get_post_thumbnail_id($post->ID))); $output = ""; foreach ($rt_social_share_list as $key => $value) { $value["url"] = str_replace("[URL]", $permalink, $value["url"]); $value["url"] = str_replace("[TITLE]", $title, $value["url"]); $value["url"] = str_replace("[MEDIA]", $image, $value["url"]); $output .= '<li class="' . $value["icon_name"] . '">'; $output .= $value["popup"] ? '<a class="icon-' . $value["icon_name"] . ' " href="#" data-url="' . $value["url"] . '" title="' . $key . '">' : '<a class="icon-' . $value["icon_name"] . ' " href="' . $value["url"] . '" title="' . $key . '">'; $output .= '<span>' . $key . '</span>'; $output .= '</a>'; $output .= '</li>'; } return ' <div class="social_share_holder"> <div class="share_text"><span class="icon-share">' . __("Share", "rt_theme") . '</span></div> <ul class="social_media">' . $output . '</ul> </div>'; }
/** * Latest blog posts * * @param int $limit post display limit * * @param string $thumbnail_size * * @return array */ public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail') { $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true); $array_out = array(); $recent_posts = \get_posts(\wp_parse_args($args)); /*$like_bool = Option::get_theme_option( 'blog_list_like' ); if ( $like_bool === '1' ) { $PostLike = \SilverWp\Ajax\PostLike::getInstance(); }*/ foreach ($recent_posts as $key => $recent) { \setup_postdata($recent); $post_id = $recent->ID; //$array_out[ $key ] = $recent; $array_out[$key]['ID'] = $post_id; $array_out[$key]['post_title'] = \get_the_title($post_id); $array_out[$key]['url'] = \get_the_permalink($post_id); $array_out[$key]['post_author'] = \get_the_author(); $array_out[$key]['post_date'] = \get_the_date('', $post_id); $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id); //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : ''; $array_out[$key]['post_comment_count'] = $recent->comment_count; if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) { $array_out[$key]['post_excerpt'] = \get_the_excerpt(); } else { $array_out[$key]['post_excerpt'] = $recent->post_excerpt; } $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size); // Thumbnail $array_out[$key]['categories'] = self::getTaxonomy($post_id); } \wp_reset_postdata(); return $array_out; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { echo $args['before_widget']; $display_title = !empty($instance['display_title']) ? $instance['display_title'] : ''; $numberofposts = !empty($instance['numberofposts']) ? absint($instance['numberofposts']) : ''; if ($display_title == 'on') { if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } } $post_query_args = array('post_type' => array('post'), 'pagination' => false, 'posts_per_page' => $numberofposts, 'ignore_sticky_posts' => true, 'cache_results' => true, 'update_post_meta_cache' => true, 'update_post_term_cache' => true); $post_query = new WP_Query($post_query_args); if ($post_query->have_posts()) { while ($post_query->have_posts()) { $post_query->the_post(); global $post; $output = ''; $output .= '<div class="widget-recent-post clearfix">'; $output .= has_post_thumbnail($post->ID) ? '<div class="recent-post-image">' : ''; $output .= has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'illdy-widget-recent-posts') : ''; $output .= has_post_thumbnail($post->ID) ? '</div><!--/.recent-post-image-->' : ''; $output .= '<a href="' . esc_url(get_the_permalink()) . '" title="' . esc_attr(get_the_title()) . '" class="recent-post-title">' . esc_html(get_the_title()) . '</a>'; $output .= '<a href="' . esc_url(get_the_permalink()) . '" title="' . __('More...', 'illdy') . '" class="recent-post-button">' . __('More...', 'illdy') . '</a>'; $output .= '</div><!--/.widget-recent-post.clearfix-->'; echo $output; } } else { echo __('No posts found.', 'illdy'); } wp_reset_postdata(); echo $args['after_widget']; }
function bl_posttype_shortcodes_showposts($params = array()) { // Pulls the paramater values passed from the shortcode options extract(shortcode_atts(array('post_type' => 'post', 'post_status' => 'publish', 'offset' => 0, 'posts_per_page' => ''), $params)); // Builds the query based on the available params $query = new WP_Query(array('post_type' => $post_type, 'post_status' => $post_status, 'offset' => $offset, 'posts_per_page' => $posts_per_page)); // Looks for the presence of any qualifying posts inside the defined loop if ($query->have_posts()) { // We open the post container only where specified posts are available $shortcodeOutput = '<div>'; while ($query->have_posts()) { $query->the_post(); // Wraps each qualifying post for output in an <article> tag with Schema data. $shortcodeOutput .= '<article itemscope itemtype="http://schema.org/Article">'; $shortcodeOutput .= '<a href="' . get_the_permalink() . '">'; $shortcodeOutput .= '<h3 itemprop="name">' . get_the_title() . '</h3>'; $shortcodeOutput .= '</a>'; $shortcodeOutput .= '<time itemprop="dateCreated">' . get_the_date() . '</time>'; $shortcodeOutput .= '<em itemprop="author">' . get_the_author() . '</em>'; $shortcodeOutput .= '<div itemprop="description">' . get_the_excerpt() . '</div>'; $shortcodeOutput .= '<article>'; } // Closes off the parent container $shortcodeOutput .= '</div>'; } // Resets the wordpress loop wp_reset_postdata(); // Returns the concatenated shortcodeOutput to the page return $shortcodeOutput; }
/** * This function actually adds the post to the list of network recent posts when it is published for the first time. * * If the content on the post is empty then the title will be 'Auto Draft' and so it is not added to the list * until it is published with content. Once a post has made it to the list it is never added back to the beginning. * That is, if you update the post it will not come back on to the list, nor would it move to the front if it was * already on the list. */ function Add_Post_To_H1_Recent_Posts_From_Network() { global $post; if ($post->post_title == __('Auto Draft')) { return; } if (!get_post_meta($post->ID, 'published_once', true) && ($post->ID != 1 || strpos($post->content, $this->first_post) === false)) { global $wpdb; $domains = array(); $blog_id = get_current_blog_id(); // Ignore main site posts if ($blog_id == BLOG_ID_CURRENT_SITE) { return; } $rows = $wpdb->get_results("SELECT * FROM {$wpdb->dmtable} WHERE `blog_id`={$blog_id} ORDER BY id DESC LIMIT 0,1"); foreach ($rows as $key => $val) { $domains[] = 'http://' . $val->domain; } $orig_blogurl = get_option('home') ? get_option('home') : get_option('siteurl'); $mapped_blogurl = count($domains) > 0 ? $domains[0] : $orig_blogurl; $thumbnail = get_the_post_thumbnail($post->ID, 'medium', array('class' => 'hrpn-alignleft hrpn-thumb')); $essential_post_data = array('title' => $post->post_title, 'permalink' => str_replace($orig_blogurl, $mapped_blogurl, get_the_permalink($post->ID)), 'thumbnail' => $thumbnail, 'date' => $post->post_date); $current_recent_posts = get_site_option('network_latest_posts'); if (empty($current_recent_posts)) { $current_recent_posts = array(); } array_unshift($current_recent_posts, $essential_post_data); $new_recent_posts = array_slice($current_recent_posts, 0, 50); update_site_option('network_latest_posts', $new_recent_posts); update_post_meta($post->ID, 'published_once', 'true'); } }
/** # CHECK_REFERER_LINK * * */ public function check_referer_link() { if (isset($_POST['ykdi_referer'])) { ?> <script type="text/javascript"> jQuery(document).ready(function($) { var href = '<?php echo get_the_permalink(intval($_POST['ykdi_referer'])); ?> '; var html = '<p>If you\'re not redirected in five seconds, click the link below.</p>'; html += '<p><a href="<?php echo get_the_permalink(intval($_POST['ykdi_referer'])); ?> ">Back to page</a></p>'; $( '#signup_form' ).append(html); setTimeout(function() { window.location.href = href; }, 5000); }); </script> <?php } }
/** * front-end display of the widget * * @param $args widget arguments * @param $instance saved values from database */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $page_id = apply_filters('page_thumbani_page_id', $instance['page_id']); $thumbnail_size = apply_filters('page_thumbani_thumbnail_size', $instance['thumbnail_size']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $wp_query = new WP_Query(array('page_id' => $page_id)); if ($wp_query->have_posts()) { while ($wp_query->have_posts()) { $wp_query->the_post(); ?> <div class="text-center page-thumbnail-widget--content circle-hover"> <?php if (has_post_thumbnail()) { the_post_thumbnail($thumbnail_size, array('class' => 'img-center img-circle img-responsive')); } ?> </div> <?php the_title('<div class="row"><div class="col-md-10 col-md-offset-1 text-center"><h3 class="page-thumbnail-title"><a href="' . get_the_permalink() . '">', '</a></h3></div></div>'); ?> <?php } } wp_reset_query(); echo $after_widget; }
/** * Returns the share URL. * * @since 1.0.0 * @return string */ public function get_share_url() { // TODO sharer.php no longer accepts custom post paramters (e.g title) and just retries the OG // params for the page. The modern way is to use the share dialog, but that requires the user // to have registered an app on Facebook - we should support both. return 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode(get_the_permalink()); }
function slider($queried_posts) { global $post; ?> <section class="l-clear js-flickity m-flickity" data-flickity-options='{ "cellAlign": "left", "contain": true, "prevNextButtons": false, "wrapAround": true, "autoPlay": true}'> <?php foreach ($queried_posts as $post) { setup_postdata($post); echo '<a class="gallery-cell m-prf ratio-4-3 overlay" href="' . get_the_permalink() . '" title="' . get_the_title() . '">'; if (function_exists('makeitSrcset') && has_post_thumbnail()) { makeitSrcset(get_post_thumbnail_id($post->ID), 83, 62, 39, 34, 28); } echo '<h3 class="a-medium a-prf-text">' . get_the_title(); echo '<br/>'; echo '<span class="a-prf-text__span">'; echo get_the_time('Y-m-d'); if (has_tag()) { echo strip_tags(get_the_tag_list(' · ', ' · ', '')); } echo '</span>'; echo '</h3>'; echo '</a>'; } ?> </section> <?php wp_reset_postdata(); }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { $instance = wp_parse_args($instance, array('title' => '', 'post_type' => 'micro-projet')); echo $args['before_widget']; if ($instance['title']) { /** This filter is documented in core/src/wp-includes/default-widgets.php */ echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } // Show last micro project $micro_project_query_args = array('post_type' => $instance['post_type'], 'posts_per_page' => 5); if (is_singular()) { $micro_project_query_args['post__not_in'] = array(get_the_ID()); } $micro_project_query = new WP_Query($micro_project_query_args); if ($micro_project_query->have_posts()) { echo '<ul>'; while ($micro_project_query->have_posts()) { $micro_project_query->the_post(); echo '<li>'; echo '<a href="' . get_the_permalink() . '">'; the_post_thumbnail('large'); the_title('<h3>', '</h3>'); echo '</a>'; echo '</li>'; } echo '</ul>'; wp_reset_postdata(); } echo $args['after_widget']; }
/** * WooCommerce Share Hook */ function zo_woo_share() { global $post; ?> <ul class="social-list"> <li class="box"><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_the_permalink(); ?> " onclick="javascript:void window.open(this.href,'','width=600,height=300,resizable=true,left=200px,top=200px');return false;"><i class="fa fa-facebook"></i></a></li> <li class="box"><a href="https://twitter.com/intent/tweet?text=<?php echo get_the_title(); ?> &url=<?php echo get_the_permalink(); ?> " onclick="javascript:void window.open(this.href,'','width=600,height=300,resizable=true,left=200px,top=200px');return false;"><i class="fa fa-twitter"></i></a></li> <li class="box"><a href="https://www.linkedin.com/cws/share?url=<?php echo get_the_permalink(); ?> " onclick="javascript:void window.open(this.href,'','width=600,height=300,resizable=true,left=200px,top=200px');return false;"><i class="fa fa-linkedin"></i></a></li> <li class="box"><a href="https://plus.google.com/share?url=<?php echo get_the_permalink(); ?> " onclick="javascript:void window.open(this.href,'','width=600,height=300,resizable=true,left=200px,top=200px');return false;"><i class="fa fa-google-plus"></i></a></li> <li class="box"><a href="http://pinterest.com/pin/create/button?url=<?php echo get_the_permalink(); ?> " onclick="javascript:void window.open(this.href,'','width=600,height=300,resizable=true,left=200px,top=200px');return false;"><i class="fa fa-pinterest"></i></a></li> </ul> <?php }
public function render($atts, $content = null) { $css = ''; extract(shortcode_atts(array('css' => ''), $atts)); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class($css, ' ')); $events = new WP_Query(array('post_type' => 'event', 'posts_per_page' => 4, 'order' => 'ASC', 'orderby' => 'event_when', 'meta_query' => array(array('key' => 'event_when', 'value' => current_time('timestamp'), 'compare' => '>')))); $output = ''; if ($events->have_posts()) { $output .= '<div class="event_list_module ' . $css_class . '">'; $output .= '<ul class="events_list clearfix">'; while ($events->have_posts()) { $events->the_post(); $output .= '<li id="post-' . get_the_ID() . '" class="' . implode(' ', get_post_class()) . '">'; $output .= '<div class="event-content">'; $output .= '<div class="event-date_wrapper">'; $output .= '<div class="event_top"></div>'; $output .= '<div class="event-date">'; $output .= date('d', get_post_meta(get_the_ID(), 'event_when', true)); $output .= '<span>' . date('F', get_post_meta(get_the_ID(), 'event_when', true)) . '</span>'; $output .= '<div class="event-date-border"></div>'; $output .= '</div>'; $output .= '</div>'; $output .= '<h5><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h5>'; $output .= '<cite>' . get_post_meta(get_the_ID(), 'event_where', true) . '</cite>'; $output .= '<a href="' . get_the_permalink() . '" class="button">' . __('More Details', STM_DOMAIN) . '</a>'; $output .= '</div>'; $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; } wp_reset_query(); return $output; }
public function widget($args, $instance) { global $asgarosforum; if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } $title = !empty($instance['title']) ? $instance['title'] : __('Recent forum posts', 'asgaros-forum'); $title = apply_filters('widget_title', $title, $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 3; if (!$number) { $number = 3; } $target = !empty($instance['target']) ? $instance['target'] : ''; $posts = $asgarosforum->get_last_posts($number); if (!empty($posts)) { echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } echo '<ul class="asgarosforum-widget">'; foreach ($posts as $post) { echo '<li>'; echo '<span class="post-link"><a href="' . $asgarosforum->get_widget_link($post->parent_id, $post->id, get_the_permalink($target)) . '">' . $asgarosforum->cut_string($post->name) . '</a></span>'; echo '<span class="post-author">' . __('by', 'asgaros-forum') . ' <b>' . $asgarosforum->get_username($post->author_id, false, true) . '</b></span>'; echo '<span class="post-date">' . sprintf(__('%s ago', 'asgaros-forum'), human_time_diff(strtotime($post->date), current_time('timestamp'))) . '</span>'; echo '</li>'; } echo '</ul>'; echo $args['after_widget']; } }
/** * Outputs the HTML of the widget * * @param array $args * * @param array $instance * * @since 1.4 */ public function widget($args, $instance) { extract($args); if (is_single()) { $fields = get_post_meta(get_the_ID(), 'read_more_links', true); if ($fields) { echo $args['before_widget']; echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; echo '<aside class="read-more-about-widget">'; foreach ($fields as $field) { echo '<div class="story">'; if ($field['read_more_about_in_ex'] == 'internal') { if (has_post_thumbnail($field['read_more_about_internal_link'])) { echo '<div class="photo"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_post_thumbnail($field['read_more_about_internal_link'], 'read-more') . '</a></div>'; } echo '<h3 class="story-title"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_title($field['read_more_about_internal_link']) . '</a></h3>'; } else { echo '<h3 class="story-title"><a href="' . $field['read_more_about_link'] . '" target="_blank">' . $field['read_more_about_external_title'] . '</a></h3>'; } echo '</div>'; } echo '</aside>'; echo $args['after_widget']; } } }
function get_skills_registration($atts) { $string = ''; //$attributes = shortcode_atts( array(), $atts ); //get attributes $args = array('posts_per_page' => -1, 'post_type' => 'skeleton_skill', 'orderby' => 'menu_order', 'order' => 'ASC'); $skills = get_posts($args); global $post; $string .= "<h3 class='shortcode-title'>Skills</h3>"; $i = 0; foreach ($skills as $post) { $i++; if ($i % 2 == 0) { $class = 'right'; } else { $class = 'left'; } setup_postdata($post); $bg_image_url = '"' . wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full') . '"'; $content = get_the_excerpt(); $title = get_the_title(); $link = get_the_permalink(); $string .= "<div class='skill-container' style='background-image: url({$bg_image_url})'>"; $string .= "<a class='skill-link' href='{$link}' title='{$title}'></a>"; $string .= "<div class='skill-content {$class}'>"; $string .= "<h4>{$title}</h4>"; $string .= "<div class='description'>{$content}</div>"; $string .= "</div>"; //skill-content $string .= "</div>"; //skill-container } wp_reset_query(); return $string; }
function wp_recent_posts() { $postlist = get_posts('order=desc&posts_per_page=-1'); $posts = array(); foreach ($postlist as $post) { $posts[] += $post->ID; } $current = array_search(get_the_ID(), $posts); $recent_posts = array_slice($posts, $current + 1, 3); if (count($recent_posts)) { ?> <div class="recent"> <h3>Предыдущие статьи</h3> <ul> <?php foreach ($recent_posts as $post) { ?> <li><a href="<?php echo get_the_permalink($post); ?> "><?php echo get_the_title($post); ?> </a> </li> <?php } ?> </ul> </div> <?php } }
/** * Display the post thumbnail * * @return void */ function hanna_post_thumbnail($postid) { if (post_password_required() || !has_post_thumbnail()) { return; } $theme_options = get_theme_mod('zilla_theme_options'); $format = get_post_format(); if ($format == 'link') { $link_to = get_post_meta($postid, '_zilla_link_url', true); } else { $link_to = get_the_permalink($postid); } ?> <div class="entry-thumbnail"> <?php if (is_singular() || is_layout_standard()) { the_post_thumbnail('full'); } else { ?> <a href="<?php echo esc_url($link_to); ?> "> <?php the_post_thumbnail(); ?> </a> <?php } ?> </div> <?php }
/** * Display the post thumbnail * * @return void */ function base_post_thumbnail($postid) { if (post_password_required() || !has_post_thumbnail()) { return; } $format = get_post_format(); if ($format == 'link') { $link_to = get_post_meta($postid, '_zilla_link_url', true); } else { $link_to = get_the_permalink($postid); } ?> <div class="entry-thumbnail"> <?php if (is_singular()) { the_post_thumbnail('full'); } else { ?> <a href="<?php echo esc_url($link_to); ?> "> <?php the_post_thumbnail('blog-thumb'); ?> </a> <?php } ?> </div> <?php }
function viradeco_new_user_notification($user_id, $plaintext_pass = '') { $user = get_userdata($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); $viraclub_id = get_user_meta($user_id, 'viraclub', 1); $viraclub_id = $viraclub_id ? $viraclub_id : ""; // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $message = sprintf(__('New user registration in %s:', 'viradeco'), $blogname) . "\r\n\r\n"; $message .= sprintf(__('Username: %s', 'viradeco'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s', 'viradeco'), $user_email) . "\r\n"; $message .= sprintf(__('Vira Club ID : V%s', 'viradeco'), $viraclub_id) . "\r\n"; wp_mail(get_option('admin_email'), sprintf(__('New User Registration', 'viradeco'), $blogname), $message); if (empty($plaintext_pass)) { return; } $message = __('Your Information : ', 'viradeco') . "\r\n"; $message .= sprintf(__('Username: %s', 'viradeco'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s', 'viradeco'), $plaintext_pass) . "\r\n"; $message .= sprintf(__('Vira Club ID : V%s', 'viradeco'), $viraclub_id) . "\r\n"; $message .= get_the_permalink() . "\r\n"; wp_mail($user_email, sprintf(__('Welcome to Vira', 'viradeco'), $blogname), $message); }
function Insert_Logout($atts) { // Include the required global variables, and create a few new ones $Salt = get_option("EWD_FEUP_Hash_Salt"); $Custom_CSS = get_option("EWD_FEUP_Custom_CSS"); $CookieName = urlencode("EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt))); $feup_Label_Successful_Logout_Message = get_option("EWD_FEUP_Label_Successful_Logout_Message"); if ($feup_Label_Successful_Logout_Message == "") { $feup_Label_Successful_Logout_Message = __("You have been successfully logged out.", "EWD_FEUP"); } $ReturnString = ""; // Get the attributes passed by the shortcode, and store them in new variables for processing extract(shortcode_atts(array('no_message' => '', 'redirect_page' => '#', 'no_redirect' => 'No', 'submit_text' => 'Logout'), $atts)); if ($no_redirect != "Yes" and isset($_COOKIE[$CookieName])) { $redirect_page = get_the_permalink(); } setcookie($CookieName, "", time() - 3600, "/"); $_COOKIE[urldecode($CookieName)] = ""; if ($redirect_page != "#") { FEUPRedirect($redirect_page); } $ReturnString .= "<style type='text/css'>"; $ReturnString .= $Custom_CSS; $ReturnString .= EWD_FEUP_Add_Modified_Styles(); $ReturnString .= "<div class='feup-information-div'>"; $ReturnString .= $feup_Label_Successful_Logout_Message; $ReturnString .= "</div>"; if ($no_message != "Yes") { return $ReturnString; } }
function ux_block_scripts() { global $typenow; if ('blocks' == $typenow && isset($_GET["post"])) { ?> <script> jQuery( document ).ready(function($) { var preview_url = $('input[value="preview_url"]').parent().parent().find('textarea').val(); var preview_title = $('input[value="preview_title"]').parent().parent().find('textarea').val(); var block_id = $('input#post_name').val(); $('#submitdiv').after('<div class="postbox"><div class="inside"><p>Shortcode:<br> <b>[block id="'+block_id+'"]</b></p></div></div>'); if(preview_url){ $('#view-post-btn a').attr('href',preview_url+'?block=block-'+block_id); $('#view-post-btn a').html('View block in <b>'+preview_title+'</b>'); $('#edit-slug-box a[href="#"]').remove(); } }); </script> <?php } if (isset($_GET["preview_url"])) { $permalink = get_the_permalink($_GET["preview_url"]); $preview_title = get_the_title($_GET["preview_url"]); add_post_meta($_GET["post"], 'preview_url', $permalink, true) || update_post_meta($_GET["post"], 'preview_url', $permalink); add_post_meta($_GET["post"], 'preview_title', $preview_title, true) || update_post_meta($_GET["post"], 'preview_title', $preview_title); } }
function mostrarRevistas() { // WP_Query arguments $args = array('post_type' => array('revistas'), 'order' => 'DESC'); // The Query $revistas = new WP_Query($args); if ($revistas->have_posts()) { $outputs = '<div class="grids entries revistas">'; while ($revistas->have_posts()) { $revistas->the_post(); $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id, 'big', true); $url = $thumb_url[0]; $outputs .= '<article class="grid-3 post type-post format-standard has-post-thumbnail hentry">'; $outputs .= '<figure class="entry-image inview">'; $outputs .= '<a href="' . get_the_permalink() . '">'; $outputs .= '<img src="' . $url . '" class="attachment-rectangle-size wp-post-image" alt="' . get_the_title() . '">'; $outputs .= '</a>'; $outputs .= '</figure>'; $outputs .= '<header class="entry-header">'; $outputs .= '<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>'; $outputs .= '</header>'; $outputs .= '</article>'; } $outputs .= '</div>'; } wp_reset_query(); // Restore global post data stomped by the_post(). return $outputs; }
function hocwp_facebook_comment($args = array()) { $args = apply_filters('hocwp_facebook_comment_args', $args); $colorscheme = isset($args['colorscheme']) ? $args['colorscheme'] : 'light'; $colorscheme = apply_filters('hocwp_facebook_comment_colorscheme', $colorscheme, $args); $href = isset($args['href']) ? $args['href'] : ''; if (empty($href)) { if (is_single() || is_page() || is_singular()) { $href = get_the_permalink(); } } if (empty($href)) { $href = $this->get_current_url(); } $href = apply_filters('hocwp_facebook_comment_href', $href, $args); $mobile = isset($args['mobile']) ? $args['mobile'] : ''; $num_posts = isset($args['num_posts']) ? $args['num_posts'] : 10; $num_posts = apply_filters('hocwp_facebook_comment_num_posts', $num_posts, $args); $order_by = isset($args['order_by']) ? $args['order_by'] : 'social'; $width = isset($args['width']) ? $args['width'] : '100%'; $width = apply_filters('hocwp_facebook_comment_width', $width, $args); $loading_text = hocwp_get_value_by_key($args, 'loading_text', __('Loading...', 'hocwp-theme')); $div = new HOCWP_HTML('div'); $div->set_class('fb-comments'); $atts = array('data-colorscheme' => $colorscheme, 'data-href' => $href, 'data-mobile' => $mobile, 'data-numposts' => $num_posts, 'data-order-by' => $order_by, 'data-width' => $width); $atts = apply_filters('hocwp_facebook_comment_attributes', $atts, $args); $div->set_attribute_array($atts); $div->set_text($loading_text); $div->output(); }
/** * Template part for displaying table of contents. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package easydita_knowledge_portal * */ function show_subsections_in_toc($page_id, $subsections) { ?> <div style="overflow:hidden;" page-id="<?php echo $page_id; ?> " class="closed"> <ul class="toc-list"> <?php for ($i = 0; $i < count($subsections); $i++) { $text = preg_replace('#<[^>]*>#', '', $subsections[$i]); preg_match('#(?<= id=")[^"]*#', $subsections[$i], $id); $href = $ul_is_parent ? '#' . $id[0] : get_the_permalink() . '#' . $id[0]; ?> <li class="toc-item"> <a href="<?php echo $href; ?> "><?php echo $text; ?> </a> </li> <?php } ?> </ul> </div> <?php }
/** * Add course to cart * * @param int $course_id * @param int $quantity * @param array */ function add_to_cart($course_id, $quantity = 1, $item_data = array()) { if (!learn_press_is_enable_cart()) { $this->empty_cart(); } $course = learn_press_get_course($course_id); /* if ( !empty( $this->_cart_content['items'][$course_id] ) ) { $quantity += $this->_cart_content['items'][$course_id]['quantity']; }*/ $quantity = 1; $this->_cart_content['items'][$course_id] = apply_filters('learn_press_add_cart_item', array('item_id' => $course_id, 'quantity' => $quantity, 'subtotal' => $course->get_price() * $quantity, 'total' => $course->get_price() * $quantity, 'data' => $item_data)); do_action('learn_press_add_to_cart', $course_id, $quantity, $item_data, $this); $button = ''; if (learn_press_is_enable_cart()) { if (LP()->settings->get('redirect_after_add') == 'yes') { $redirect = learn_press_get_page_link('cart'); $button = sprintf('<a href="%s">%s</a>', get_the_permalink($course_id), __('Back to class', 'learn_press')); } else { $redirect = get_the_permalink($course_id); $button = sprintf('<a href="%s">%s</a>', learn_press_get_page_link('cart'), __('View cart', 'learn_press')); } } else { $redirect = learn_press_get_page_link('checkout'); } $redirect = apply_filters('learn_press_add_to_cart_redirect', $redirect, $course_id); learn_press_add_notice(sprintf(__('<strong>%s</strong> has been added to your cart. %s', 'learn_press'), get_the_title($course_id), $button)); if (is_ajax()) { learn_press_send_json(array('redirect' => $redirect, 'result' => 'success', 'messages' => learn_press_get_notices(true))); } else { wp_redirect($redirect); die; } }
/** * Compile the schema.org event data into an array */ private function build_data() { global $post; $id = $post->ID; $events_data = array(); // Index by ID: this will allow filter code to identify the actual event being referred to // without injecting an additional property $events_data[$id] = new stdClass(); $events_data[$id]->{'@context'} = 'http://schema.org'; $events_data[$id]->{'@type'} = 'Event'; $events_data[$id]->name = get_the_title(); if (has_post_thumbnail()) { $events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); } $events_data[$id]->url = get_the_permalink($post->ID); $events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c'); $events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c'); if (tribe_has_venue($id)) { $events_data[$id]->location = new stdClass(); $events_data[$id]->location->{'@type'} = 'Place'; $events_data[$id]->location->name = tribe_get_venue($post->ID); $events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID))); } /** * Allows the event data to be modifed by themes and other plugins. * * @param array $events_data objects representing the Google Markup for each event. */ $events_data = apply_filters('tribe_google_event_data', $events_data); // Strip the post ID indexing before returning $events_data = array_values($events_data); return $events_data; }
/** * Loop tag * Shows posts for a given tag * Usage: [corenominal-loop-tag tag=foo per_page=30] */ function corenominal_shortcode_loop_tag($atts, $content = null) { $atts = shortcode_atts(array('tag' => 'foo', 'per_page' => 30), $atts); // WP_Query arguments $args = array('post_type' => array('post'), 'post_status' => array('publish'), 'tag' => $atts['tag'], 'posts_per_page' => $atts['per_page'], 'order' => 'DESC'); // The Query $query = new WP_Query($args); $data = ''; if ($query->have_posts()) { $data .= '<h3>Related Posts</h3>'; $data .= '<ul class="related-posts">'; while ($query->have_posts()) { $query->the_post(); $data .= '<li>'; $data .= '<span>' . get_the_date('Y-m-d') . '</span> '; $data .= '<a href="' . get_the_permalink() . '">'; $data .= get_the_title(); $data .= '</a>'; $data .= '</li>'; } $data .= '</ul>'; } wp_reset_postdata(); return $data; }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } // The Query $query_args = array('post_type' => 'post', 'post_per_page' => 5, 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => 'true'); $the_query = new WP_Query($query_args); // The Loop if ($the_query->have_posts()) { echo '<ul>'; while ($the_query->have_posts()) { $the_query->the_post(); echo '<li>'; echo '<a href="' . get_the_permalink() . '" rel="bookmark">'; echo get_the_title(); echo '(' . get_post_meta(get_the_ID(), 'views', true) . ')'; echo '</a>'; echo '</li>'; } echo '</ul>'; } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata(); echo $args['after_widget']; }
function read_more_about_shortcode($atts) { extract(shortcode_atts(array('title' => __('Read More', 'read-more-about'), 'float' => 'left'), $atts)); $the_post_id = get_the_ID(); $fields = get_post_meta($the_post_id, 'read_more_links', true); $color = get_post_meta($the_post_id, 'read_more_color_scheme', true); $html = ''; if ($fields) { $html .= '<aside class="read-more-about ' . $float . ' ' . $color . '">'; $html .= '<h2 class="title">' . $title . '</h2>'; foreach ($fields as $field) { $html .= '<div class="story">'; if ($field['read_more_about_in_ex'] == 'internal') { if (has_post_thumbnail($field['read_more_about_internal_link'])) { $html .= '<div class="photo"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_post_thumbnail($field['read_more_about_internal_link'], 'read-more') . '</a></div>'; } $html .= '<h3 class="story-title"><a href="' . get_the_permalink($field['read_more_about_internal_link']) . '">' . get_the_title($field['read_more_about_internal_link']) . '</a></h3>'; } else { $html .= '<h3 class="story-title"><a href="' . $field['read_more_about_link'] . '" target="_blank">' . $field['read_more_about_external_title'] . '</a></h3>'; } $html .= '</div>'; } $html .= '</aside>'; } return $html; }