コード例 #1
2
ファイル: go.php プロジェクト: rubulh/ants
function go()
{
    //##############################################################
    global $conn_start_up;
    //##############################################################
    //##############################################################
    //pass the user identification key
    $current_user_index = get_the_id($conn_start_up, '');
    if (!$current_user_index) {
        //log one error
    }
    //##############################################################
    //##############################################################
    //extract the user current ranks
    $extract_the_user_odds = mysqli_query($conn_start_up, "select (involved+earned) from '{$table_allusers}' where index_='{$current__user_index}'");
    //change the formula here
    $fetched_odds_for_logged_in = mysqli_fetch_array($conn_start_up, $extract_the_user_odds);
    $odds_for_current_user = $fetched_odds_for_logged_in['involved+earned'];
    //##############################################################
    //##############################################################
    //pass the user rank and id to be  matched
    match_the_user($current_user_index, $odds_for_current_user);
    //no return
    //##############################################################
}
コード例 #2
0
/**
 * apply custom filters to the_excerpt in feature a page widget template
 *
 * @since 2.0.0
 */
function fpw_excerpt($excerpt)
{
    $post_id = get_the_id();
    /**
     * allow use of autogenerated excerpts
     *
     * by default, excerpt is empty if it is not explicitly set in the "Excerpt" field
     *
     * @since  2.0.0
     *
     * @param bool $fpw_auto_excerpt false by default
     * @return bool whether to allow auto-generated excerpts when excerpt is empty
     */
    $fpw_auto_excerpt = apply_filters('fpw_auto_excerpt', false);
    if (!has_excerpt() && !(bool) $fpw_auto_excerpt) {
        return;
    }
    /*$custom_excerpt = get_post_meta( $post_id, 'fpw_excerpt', true );
    	if( $custom_excerpt ) {
    		$excerpt = $custom_excerpt;
    	}*/
    /**
     * filter the_excerpt in feature a page widget
     *
     * @since  2.0.0
     *
     * @param   string 	$excerpt 	excerpt of post
     * @param   int 	$post_id 	post id
     * @return   string used as the excerpt
     */
    $excerpt = apply_filters('fpw_excerpt', $excerpt, $post_id);
    return $excerpt;
}
コード例 #3
0
function rum_post_cta_meta_box_list()
{
    global $post;
    // store global post object for later resetting after our query
    // using wp_reset_postdata() doesn't work so we are manually resetting the global
    $post_old = $post;
    // initialize variables
    $options = '';
    // get plugin option array and store in a variable
    $plugin_option_array = get_option('rum_post_cta_plugin_options');
    // fetch values from the plugin option variable array
    $post_cta_post_type = $plugin_option_array['post_type'];
    // retrieve the custom meta box value
    $post_cta_id = get_post_meta($post->ID, 'rum_post_cta_id', true);
    // set query arguments
    $args = array('post_type' => $post_cta_post_type, 'nopaging' => true);
    // execute the query
    $cta_post_query = new WP_Query($args);
    // The Loop
    while ($cta_post_query->have_posts()) {
        $cta_post_query->the_post();
        $post_title = get_the_title();
        $post_ID = get_the_id();
        $options .= '<option value="' . esc_attr($post_ID) . '" ' . selected($post_cta_id, $post_ID) . '>' . $post_title . '</option>';
    }
    // restore the global $post variable of the main query loop
    // wp_reset_postdata(); doesn't work so we are manually resetting it back
    // restore global post object
    $post = $post_old;
    setup_postdata($post);
    return $options;
}
コード例 #4
0
function salesforce_w2l_lead_source_example($lead_source, $form_id)
{
    if ($form_id == 1) {
        return 'Example Lead Source for Form #1 on page id #' . get_the_id();
    }
    return $lead_source;
}
コード例 #5
0
    public static function friend_list_func($atts, $content = "")
    {
        $atts = shortcode_atts(array('per_page' => '100'), $atts, 'friend_list');
        $return = "";
        query_posts(array('post_type' => 'friend', 'showposts' => $atts['per_page'], 'meta_query' => array('relation' => 'AND', array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_male.gif', 'compare' => 'NOT LIKE'), array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_female.gif', 'compare' => 'NOT LIKE'))));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $displayName = get_post_meta(get_the_id(), 'displayName', true);
                $avatar = get_post_meta(get_the_id(), 'avatar150', true);
                $return .= sprintf('<div class="col-lg-3 col-sm-3 focus-box">
		 								<div class="service-icon">
		 									<i style="background:url(%s) no-repeat center;width:100%%; height:100%%;" class="pixeden"></i>
		 								</div>
		 								<h3 class="red-border-bottom">%s</h3>
		 								<a class="btn btn-primary btn-block green-btn btn-sm" href="https://www.fitbit.com/user/%s"><i class="fa fa-plus"></i> Add Friend</a>
		 								<br/>
		 							</div>', $avatar, $displayName, get_the_title(), get_the_content());
            }
            $return = '<div class="hwd-wrapper"><div class="row">' . $return . '</div></div>';
        } else {
            $return = 'No Friends Found';
        }
        wp_reset_query();
        return $return;
    }
コード例 #6
0
function get_related_posts()
{
    // an array of tags from the current post
    $related_tags = get_the_tags();
    /*
    	$tag will be used in this example, this is just the first tag
    	from the array.  To optimize the plugin we would want to loop through
    	all of the tags in the $related_tags array and do something more
    	interesting with them.
    */
    $tag = $related_tags[0];
    // The ID of the current post
    $current_post = get_the_id();
    // The arguments for the nested loop
    $args = array('posts_per_page' => 3, 'post__not_in' => array($current_post), 'tag' => $tag->name);
    $related_query = new WP_Query($args);
    if ($related_query->have_posts()) {
        $html = '<h2>Some Related Posts</h2>';
        $html .= '<ul>';
        while ($related_query->have_posts()) {
            $related_query->the_post();
            $html .= '<li>';
            $html .= get_the_title();
            $html .= '</li>';
        }
        $html .= '</ul>';
    }
    return $html;
}
コード例 #7
0
/**
 *
 */
function ac_remove_wpautop()
{
    $ac_remove_autop = get_field('ac_remove_auto_p', get_the_id());
    if ($ac_remove_autop != false) {
        remove_filter('the_content', 'wpautop');
    }
}
コード例 #8
0
 /**
  * Register meta boxes related to `vr_agent` post type
  *
  * @param   array   $meta_boxes
  * @return  array   $meta_boxes
  * @since   1.0.0
  */
 public function register($meta_boxes)
 {
     $prefix = 'vr_agent_';
     $meta_boxes[] = array('id' => 'vr_agent_meta_box_details_id', 'title' => __('Contact Details', 'VRC'), 'post_types' => array('vr_agent'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => "{$prefix}job_title", 'type' => 'text', 'name' => __('Job Title', 'VRC')), array('id' => "{$prefix}email", 'type' => 'email', 'name' => __('Email Address', 'VRC'), 'desc' => __("Agent related messages from contact form on rental details page, will be sent to this email address.", "VRC")), array('id' => "{$prefix}mobile_number", 'type' => 'text', 'name' => __('Mobile Number', 'VRC')), array('name' => __('Office Number', 'VRC'), 'id' => "{$prefix}office_number", 'type' => 'text'), array('id' => "{$prefix}fax_number", 'type' => 'text', 'name' => __('Fax Number', 'VRC')), array('id' => "{$prefix}office_address", 'type' => 'textarea', 'name' => __('Office Address', 'VRC')), array('id' => "{$prefix}summary", 'type' => 'textarea', 'name' => __('Profile Summary (Optional)', 'VRC')), array('id' => "{$prefix}fb_url", 'type' => 'url', 'name' => __('Facebook URL', 'VRC')), array('id' => "{$prefix}twt_url", 'type' => 'url', 'name' => __('Twitter URL', 'VRC')), array('id' => "{$prefix}gplus_url", 'type' => 'url', 'name' => __('Google Plus URL', 'VRC')), array('id' => "{$prefix}li_url", 'type' => 'text', 'name' => __('LinkedIn URL', 'VRC')), array('id' => "{$prefix}skype_username", 'type' => 'text', 'name' => __('Skype Username', 'VRC'), 'desc' => __('Example Value: myskypeID', 'VRC')), array('id' => "{$prefix}insta_url", 'type' => 'url', 'name' => __('Instagram URL', 'VRC')), array('id' => "{$prefix}ytube_url", 'type' => 'url', 'name' => __('Youtube URL', 'VRC'))));
     // Metboxes array ended.
     $meta_boxes[] = array('id' => 'vr_agent_meta_box_rental_id', 'title' => __('Rental Properties Owner', 'VRC'), 'post_types' => array('vr_agent'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => "{$prefix}rental_owner", 'type' => 'custom_html', 'callback' => function () {
         global $post;
         // Get the rentals where `vr_rental_the_agent` is this agent.
         // That is get the rentals where this agent is the owner.
         $args = array('post_type' => 'vr_rental', 'orderby' => 'meta_value_num', 'meta_key' => 'vr_rental_the_agent', 'meta_value' => $post->ID);
         $the_rentals = new WP_Query($args);
         echo '<div class="rwmb-field">';
         if ($the_rentals->have_posts()) {
             echo '<ol>';
             while ($the_rentals->have_posts()) {
                 $the_rentals->the_post();
                 // Frontend link.
                 // $li_format = '<li><a href="%s"> %s </a></li>';
                 // echo sprintf( $li_format, get_the_permalink() , get_the_title() );
                 // Backend link.
                 $li_format = '<li><a href="/wp-admin/post.php?post=%s&action=edit"> %s </a></li>';
                 echo sprintf($li_format, get_the_id(), get_the_title());
             }
             echo '</ol>';
         } else {
             echo "No rental property owned by this agent.";
         }
         echo '</div>';
     })));
     // Metboxes array ended.
     return $meta_boxes;
 }
コード例 #9
0
 /**
  * Migrate meta values to taxonomy terms. Delete meta after import
  *
  * ## OPTIONS
  *
  * <meta-key>
  * : Meta key to convert
  *
  * <taxonomy-slug>
  * : Taxonomy to move values into
  *
  * [--<field>=<value>]
  * : One or more args to pass to WP_Query.
  *
  * ## EXAMPLES
  *
  *     wp mtt migrate meta_key taxonomy_slug
  *     wp mtt migrate meta_key taxonomy_slug --posts_per_page=200 --paged=2
  *
  */
 function migrate($args, $assoc_args)
 {
     list($meta_key, $taxonomy) = $args;
     if (!($taxonomy_object = get_taxonomy($taxonomy))) {
         WP_CLI::error(sprintf("The taxonomy '%s' doesn't exist", $taxonomy));
     }
     $defaults = array('post_type' => $taxonomy_object->object_type, 'posts_per_page' => -1, 'post_status' => 'any');
     $query_args = array_merge($defaults, $assoc_args);
     $query = new WP_Query($query_args);
     // summary
     WP_CLI::log(sprintf("---\nPer page: %d \nPage: %d \nTotal pages: %d\n---", $query_args['posts_per_page'], isset($query_args['paged']) ? $query_args['paged'] : 1, $query->max_num_pages));
     while ($query->have_posts()) {
         $query->the_post();
         $id = get_the_id();
         // get meta
         $metas = get_post_meta($id, $meta_key);
         // create term
         if (!$metas) {
             WP_CLI::log(WP_CLI::colorize("%c[{$id}]%n No meta, skipped"));
         } else {
             if (!is_wp_error(wp_set_object_terms($id, $metas, $taxonomy, true))) {
                 WP_CLI::log(WP_CLI::colorize("%g[{$id}]%n Migrated: " . implode(', ', $metas)));
                 // clean meta
                 delete_post_meta($id, $meta_key);
             } else {
                 WP_CLI::log(WP_CLI::colorize("%r[{$id}]%n Error: Could not set terms for post"));
             }
         }
     }
 }
コード例 #10
0
ファイル: FmFunction.php プロジェクト: dorkyhuman/things
 function getPriceWithLabel()
 {
     global $TLPfoodmenu;
     $settings = get_option($TLPfoodmenu->options['settings']);
     $currency = @$settings['general']['currency'] ? esc_attr(@$settings['general']['currency']) : "USD";
     $currencyP = @$settings['general']['currency_position'] ? esc_attr(@$settings['general']['currency_position']) : "right";
     @($price = get_post_meta(get_the_id(), 'price', true));
     $cList = $TLPfoodmenu->currency_list();
     $symbol = $cList[$currency]['symbol'];
     switch ($currencyP) {
         case 'left':
             $price = $symbol . $price;
             break;
         case 'right':
             $price = $price . $symbol;
             break;
         case 'left_space':
             $price = $symbol . " " . $price;
             break;
         case 'right_space':
             $price = $price . " " . $symbol;
             break;
         default:
             break;
     }
     return $price;
 }
コード例 #11
0
ファイル: PeThemeVisia.php プロジェクト: JeffreyBue/jb
 public function wp_nav_menu_objects_filter($items, $args)
 {
     if (is_array($items) && !empty($args->theme_location)) {
         $home = false;
         if (is_page()) {
             if ($this->content->pageTemplate() === "page-home.php") {
                 $home = get_page_link(get_the_id());
             }
         }
         foreach ($items as $id => $item) {
             if (!empty($item->post_parent)) {
                 if ($item->object === "page") {
                     $page = get_page($item->object_id);
                     if (!empty($page->post_name)) {
                         $parent = get_page_link($item->post_parent);
                         $slug = $page->post_name;
                         $items[$id]->url = "{$parent}#{$slug}";
                     }
                 }
             } else {
                 if ($item->url === $home) {
                     $items[$id]->url .= "#home";
                 }
             }
         }
     }
     return $items;
 }
コード例 #12
0
ファイル: Frontend.php プロジェクト: s3rgiosan/wpsmartlook
 /**
  * Add custom javascript within head section.
  *
  * @since 1.0.0
  */
 public function add_snippet()
 {
     if (\is_admin()) {
         return;
     }
     if (\is_feed()) {
         return;
     }
     if (\is_robots()) {
         return;
     }
     if (\is_trackback()) {
         return;
     }
     $disable_recording = boolval(\get_post_meta(\get_the_id(), 'smartlook_disable_rec', true));
     // Disable recording for this content type
     if ($disable_recording) {
         return;
     }
     $snippet = trim(\get_option('smartlook_snippet'));
     if (empty($snippet)) {
         return;
     }
     echo $snippet;
 }
コード例 #13
0
ファイル: instapaper.php プロジェクト: rmccue/Lilina
/**
 * Add the link to the item actions
 *
 * @param array $actions Previous actions
 * @return array Array with Tweet It added.
 */
function instapaper_button($actions)
{
    require_once LILINA_PATH . '/admin/includes/common.php';
    $tweet_url = sprintf(get_option('baseurl') . '?method=instapaper&id=%1$s&_nonce=%2$s', get_the_id(), generate_nonce());
    $actions[] = '<a href="' . $tweet_url . '" class="instapaper_button" title="' . _r('Save to Instapaper', 'instapaper') . '">' . _r('Read Later', 'instapaper') . '</a>';
    return $actions;
}
コード例 #14
0
function gs_logo_shortcode($atts)
{
    extract(shortcode_atts(array('posts' => -1, 'order' => 'DESC', 'orderby' => 'date', 'title' => 'no'), $atts));
    $loop = new WP_Query(array('post_type' => 'gs-logo-slider', 'order' => 'DESC', 'orderby' => 'date', 'title' => $title, 'posts_per_page' => 20));
    $output = '<div class="gs_logo_container">';
    if ($loop->have_posts()) {
        while ($loop->have_posts()) {
            $loop->the_post();
            $meta = get_post_meta(get_the_id());
            $gs_logo_id = get_post_thumbnail_id();
            $gs_logo_url = wp_get_attachment_image_src($gs_logo_id, array(200, 200), true);
            $gs_logo = $gs_logo_url[0];
            $gs_logo_alt = get_post_meta($gs_logo_id, '_wp_attachment_image_alt', true);
            $output .= '<div class="gs_logo_single">';
            if ($meta['client_url'][0]) {
                $output .= '<a href="' . $meta['client_url'][0] . '" target="_blank">';
            }
            if ($gs_logo) {
                $output .= '<img src="' . $gs_logo . '" alt="' . $gs_logo_alt . '" >';
            }
            if ($meta['client_url'][0]) {
                $output .= '</a>';
            }
            if ($title == "yes") {
                $output .= '<h3 class="gs_logo_title">' . get_the_title() . '</h3>';
            }
            $output .= '</div>';
        }
    } else {
        $output .= "No Logo Added!";
    }
    $output .= '</div>';
    return $output;
}
コード例 #15
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function impronta_metadata()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         echo '<p class="metadata">';
         $byline = sprintf(esc_html_x('By %s', 'post author', 'impronta'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span> ');
         echo $byline;
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'impronta'));
         if ($categories_list && impronta_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html_x('on %1$s ', 'on categories', 'impronta') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'impronta'));
         if ($tags_list) {
             printf(esc_html__('tagged %1$s', 'impronta'), $tags_list);
             // WPCS: XSS OK.
         }
         if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
             if (get_comments_number(get_the_id()) == 0) {
                 echo esc_html__('- ', 'impronta');
             } else {
                 echo esc_html__('with ', 'impronta');
             }
             comments_popup_link(esc_html__('Leave a comment', 'impronta'), esc_html__('1 Comment', 'impronta'), esc_html__('% Comments', 'impronta'));
         }
         if (is_sticky()) {
             echo ' - ' . '<i class="feature-star fa fa-star" data-toggle="tooltip" data-placement="right" title="' . esc_attr__('Featured Post', 'impronta') . '"></i>';
         }
         echo '</p>';
     }
 }
コード例 #16
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     extract($args);
     // User-selected settings
     $title = $instance['title'];
     $title = apply_filters('widget_title', $title);
     $date_display = isset($instance['date_display']);
     $client_display = isset($instance['client_display']);
     $category_display = isset($instance['category_display']);
     $tag_display = isset($instance['tag_display']);
     $button_label = $instance['button_label'] != '' ? $instance['button_label'] : __('Launch', 'mtphr-galleries');
     $button_target = $instance['button_target'];
     // Before widget (defined by themes)
     echo $before_widget;
     // Title of widget (before and after defined by themes)
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<table>';
     if ($date_display) {
         echo '<tr>';
         echo '<th>' . __('Date:', 'mtphr-galleries') . '</th>';
         echo '<td>' . get_the_time(get_option('date_format')) . '</td>';
         echo '</tr>';
     }
     if ($client_display) {
         $client = get_post_meta(get_the_id(), '_mtphr_gallery_client', true);
         if ($client != '') {
             echo '<tr>';
             echo '<th>' . __('Client:', 'mtphr-galleries') . '</th>';
             echo '<td>' . sanitize_text_field($client) . '</td>';
             echo '</tr>';
         }
     }
     if ($category_display) {
         $terms = get_the_term_list(get_the_id(), 'mtphr_gallery_category', '', ', ', '');
         if ($terms != '') {
             echo '<tr>';
             echo '<th>' . __('Categories:', 'mtphr-galleries') . '</th>';
             echo '<td>' . $terms . '</td>';
             echo '</tr>';
         }
     }
     if ($tag_display) {
         $terms = get_the_term_list(get_the_id(), 'mtphr_gallery_tag', '', ', ', '');
         if ($terms != '') {
             echo '<tr>';
             echo '<th>' . __('Tags:', 'mtphr-galleries') . '</th>';
             echo '<td>' . $terms . '</td>';
             echo '</tr>';
         }
     }
     echo '</table>';
     $link = get_post_meta(get_the_id(), '_mtphr_gallery_link', true);
     if ($link != '') {
         echo '<a class="btn mtphr-gallery-link" href="' . esc_url($link) . '" target="' . $button_target . '">' . $button_label . '</a>';
     }
     // After widget (defined by themes)
     echo $after_widget;
 }
コード例 #17
0
ファイル: filters.php プロジェクト: serker72/T3S
function mtphr_dnt_content($content)
{
    if (get_post_type() == 'ditty_news_ticker') {
        return '[ditty_news_ticker id="' . get_the_id() . '"]';
    }
    return $content;
}
コード例 #18
0
function if_download_price_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'equals' => '', 'greater' => '', 'less' => ''), $atts, 'if_download_price');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $price = '';
    if (edd_has_variable_prices($id)) {
        $get_default_price = edd_get_default_variable_price($id);
        $prices = edd_get_variable_prices($id);
        $price = $prices[$get_default_price]['amount'];
    } else {
        $price = edd_get_download_price($id);
    }
    if ($atts['not'] == 'yes' || $atts['not'] == '1') {
        if (!eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    } else {
        if (eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
コード例 #19
0
 public function prettyfilelist_shortcode($atts, $content = null)
 {
     //Get attributes from shortcode
     extract(shortcode_atts(array("type" => "excel,pdf,doc,zip,ppt", "filesperpage" => "7"), $atts));
     $html = '';
     //Set paging numbers
     $params = array('pageAt' => $filesperpage);
     wp_localize_script('prettylistjs', 'prettylistScriptParams', $params);
     wp_enqueue_script("jquery");
     wp_enqueue_script('prettylistjs');
     //Get a string of mime types we want
     $mimeTypesToGet = $this->TypeToMime($type);
     //Check to see if we want all types
     //If all types add filters
     //Get all attachments of the right type
     //TODO:Add option for 'orderby' => 'title'
     $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_id(), 'post_mime_type' => $mimeTypesToGet);
     $attachments = get_children($args);
     if ($attachments) {
         $html .= '<div class="prettyFileList">';
         foreach ($attachments as $attachment) {
             $html .= $this->srf_get_formatted_link($attachment);
         }
         $html .= '</div>';
     }
     return $html;
 }
コード例 #20
0
function vntd_testimonials($atts, $content = null)
{
    extract(shortcode_atts(array("posts_nr" => '6', "style" => 'simple'), $atts));
    wp_enqueue_script('owl-carousel', '', '', '', true);
    wp_enqueue_style('owl-carousel');
    ob_start();
    ?>
    
	<div class="vntd-testimonial-carousel">
	
	<?php 
    if ($style != 'expanded') {
        ?>
	
		<div class="testimonials t-center">
	
		<a class="t-arrow"></a>
		
		<h1 class="quote white">			
			<i class="fa fa-quote-right"></i>
		</h1>	
		
		<ul class="text-slider clearfix">
	
	<?php 
    } else {
        ?>
	
		<div class="clients t-center animated" data-animation="fadeIn" data-animation-delay="400">
	
	<?php 
    }
    wp_reset_postdata();
    $args = array('posts_per_page' => $posts_nr, 'post_type' => 'testimonials');
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            if ($style != 'expanded') {
                echo '<li class="text normal"><h1 class="white">' . get_post_meta(get_the_id(), 'testimonial_content', true) . '</h1>';
                echo '<p class="author uppercase">' . get_post_meta(get_the_id(), 'name', true) . '</p></li>';
            } else {
                wp_enqueue_script('owl-carousel', '', '', '', true);
                wp_enqueue_style('owl-carousel');
                echo '<div class="item"><a class="client-image"><img src="' . vntd_thumb(130, 130) . '" class="round"></a><h1 class="client-name">' . get_post_meta(get_the_id(), 'name', true) . '</h1><h3 class="client-position">' . get_post_meta(get_the_id(), 'role', true) . '</h3>';
                echo '<p class="client-desc">' . get_post_meta(get_the_id(), 'testimonial_content', true) . '</p></div>';
            }
        }
    }
    wp_reset_postdata();
    if ($style != 'expanded') {
        echo '</ul></div>';
    } else {
        echo '</div>';
    }
    echo '</div>';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
コード例 #21
0
function showhide_shortcode($atts, $content = null)
{
    // Variables
    $post_id = get_the_id();
    $word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
    // Extract ShortCode Attributes
    $attributes = shortcode_atts(array('type' => 'pressrelease', 'more_text' => __('Show Press Release (%s More Words)', 'wp-showhide'), 'less_text' => __('Hide Press Release (%s Less Words)', 'wp-showhide'), 'hidden' => 'yes'), $atts);
    // More/Less Text
    $more_text = sprintf($attributes['more_text'], $word_count);
    $less_text = sprintf($attributes['less_text'], $word_count);
    // Determine Whether To Show Or Hide Press Release
    $hidden_class = 'sh-hide';
    $hidden_css = 'display: none;';
    $hidden_aria_expanded = 'false';
    if ($attributes['hidden'] === 'no') {
        $hidden_class = 'sh-show';
        $hidden_css = 'display: block;';
        $hidden_aria_expanded = 'true';
        $tmp_text = $more_text;
        $more_text = $less_text;
        $less_text = $tmp_text;
    }
    // Format HTML Output
    $output = '<div id="' . $attributes['type'] . '-link-' . $post_id . '" class="sh-link ' . $attributes['type'] . '-link ' . $hidden_class . '"><a href="#" onclick="showhide_toggle(\'' . esc_js($attributes['type']) . '\', ' . $post_id . ', \'' . esc_js($more_text) . '\', \'' . esc_js($less_text) . '\'); return false;" aria-expanded="' . $hidden_aria_expanded . '"><span id="' . $attributes['type'] . '-toggle-' . $post_id . '">' . $more_text . '</span></a></div>';
    $output .= '<div id="' . $attributes['type'] . '-content-' . $post_id . '" class="sh-content ' . $attributes['type'] . '-content ' . $hidden_class . '" style="' . $hidden_css . '">' . do_shortcode($content) . '</div>';
    return $output;
}
コード例 #22
0
 public function register_shortcode()
 {
     $loop = new WP_Query(array('post_type' => 'selcont_lecture_type', 'orderby' => 'title'));
     if ($loop->have_posts()) {
         $output = '<div class="lectures-list">';
         while ($loop->have_posts()) {
             $loop->the_post();
             $meta = get_post_meta(get_the_id(), '');
             $output .= '
                     <h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>
                     <div>
                     <strong>' . $meta['instructor_name_meta_box'][0] . '</strong>
                     <br/>
                     ' . get_the_excerpt() . '
                     </div>
                     <hr/>
                     <br/><br/>
             ';
         }
         $output .= '</div>';
     } else {
         $output = 'No Lectures Found.';
     }
     return $output;
 }
コード例 #23
0
 public function __construct($name, $title, array $values, $args = array())
 {
     $this->id = $name;
     $this->name = $name . '[]';
     $this->title = $title;
     $this->args = wp_parse_args($args, array('repeatable' => false, 'std' => '', 'default' => '', 'show_label' => false, 'taxonomy' => '', 'hide_empty' => false, 'data_delegate' => null, 'options' => array(), 'cols' => '12', 'style' => '', 'class' => '', 'readonly' => false, 'disabled' => false));
     if (!empty($this->args['std']) && empty($this->args['default'])) {
         $this->args['default'] = $this->args['std'];
         _deprecated_argument('CMB_Field', "'std' is deprecated, use 'default instead'", '0.9');
     }
     if (!empty($this->args['options']) && is_array(reset($this->args['options']))) {
         $re_format = array();
         foreach ($this->args['options'] as $option) {
             $re_format[$option['value']] = $option['name'];
         }
         // TODO this is incorrect
         _deprecated_argument('CMB_Field', "'std' is deprecated, use 'default instead'", '0.9');
         $this->args['options'] = $re_format;
     }
     // If the field has a custom value populator callback
     if (!empty($args['values_callback'])) {
         $this->values = call_user_func($args['values_callback'], get_the_id());
     } else {
         $this->values = $values;
     }
     $this->value = reset($this->values);
     $this->description = !empty($this->args['desc']) ? $this->args['desc'] : '';
 }
コード例 #24
0
function aeg_print_carousel($atts)
{
    global $aeg_carousel_flag;
    $aeg_carousel_flag = true;
    //sets flag for scripts/styles
    $attributes = shortcode_atts(array('carousel' => ''), $atts);
    $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'aeg_carousel', 'orderby' => 'menu_order', 'order' => 'ASC', 'carousel_cat' => $attributes['carousel']));
    global $post;
    $sc_string .= '<div class="aeg-carousel flexslider">';
    $sc_string .= '<ul class="slides">';
    $i = 0;
    foreach ($posts as $post) {
        $i++;
        setup_postdata($post);
        $sc_string .= '<li class="slide" id="slide-' . $i . '">';
        $sc_string .= get_the_post_thumbnail(get_the_id(), 'full');
        $sc_string .= '</li>';
        //close .slide <li>
    }
    $sc_string .= '</ul>';
    //close .slides <ul>
    $sc_string .= '</div>';
    //close .mod-carousel <div>
    $sc_string .= '<div class="navigation">';
    $sc_string .= '<div class="prev"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M27.3 34.7L17.6 25l9.7-9.7 1.4 1.4-8.3 8.3 8.3 8.3z"/></svg></div>';
    //svgs from evil-icons, by outpunk. https://github.com/outpunk/evil-icons
    $sc_string .= '<div class="next"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M22.7 34.7l-1.4-1.4 8.3-8.3-8.3-8.3 1.4-1.4 9.7 9.7z"/></svg></div>';
    $sc_string .= '</div>';
    //close .navigation
    $sc_string .= '<div class="clearfix"></div>';
    //close .mod-carousel <div>
    wp_reset_query();
    return $sc_string;
}
コード例 #25
0
function if_download_lowest_price_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'equals' => '', 'greater' => '', 'less' => ''), $atts, 'if_download_price_lowest');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $price = '';
    $price = edd_get_download_price($id);
    // echo $price;
    if ($atts['not'] == 'yes' || $atts['not'] == '1') {
        if (!eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    } else {
        if (eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
コード例 #26
0
function if_download_name_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'is' => '', 'is_sensitive' => '', 'equals' => '', 'greater' => '', 'less' => '', 'search' => '', 'search_sensitive' => ''), $atts, 'if_download_name');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $name = get_the_title($id);
    $str_length = strlen($name);
    if ($atts['not'] == 'yes' || $atts['not'] == 1) {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($name, $atts['is']) && is_equals_sensitive($name, $atts['is_sensitive']) && is_present($name, $atts['search']) && is_present_sensitive($name, $atts['search_sensitive'])) {
            echo '';
        } else {
            echo do_shortcode($content);
        }
    } else {
        if (eval_condition($str_length, $atts['equals'], $atts['greater'], $atts['less']) && is_equals($name, $atts['is']) && is_equals_sensitive($name, $atts['is_sensitive']) && is_present($name, $atts['search']) && is_present_sensitive($name, $atts['search_sensitive'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
コード例 #27
0
 function vw_render_categories($classes = '')
 {
     $categories = get_the_category();
     $html = '';
     if (is_sticky()) {
         $html .= '<div class="label label-sticky ' . $classes . '" title="' . __('Sticky Post', 'envirra') . '"><i class="icon-entypo-megaphone"></i></div>';
     }
     if ('post' == get_post_type()) {
         if ('1' == get_post_meta(get_the_id(), 'vw_enable_review', true)) {
             $avg_score = get_post_meta(get_the_id(), 'vw_review_average_score', true);
             $html .= '<div class="label label-review ' . $classes . '" title="' . __('Classificação', 'envirra') . '"><i class="icon-entypo-star"></i> ' . $avg_score . '</div>';
         } else {
             // Show post format if not a review
             if ('gallery' == get_post_format()) {
                 $html .= '<div class="label label-light ' . $classes . '" title="' . __('Gallery Post', 'envirra') . '"><i class="icon-entypo-picture"></i></div>';
             } else {
                 if ('video' == get_post_format()) {
                     $html .= '<div class="label label-light ' . $classes . '" title="' . __('Video Post', 'envirra') . '"><i class="icon-entypo-play"></i></div>';
                 } else {
                     if ('audio' == get_post_format()) {
                         $html .= '<div class="label label-light ' . $classes . '" title="' . __('Audio Post', 'envirra') . '"><i class="icon-entypo-note-beamed"></i></div>';
                     }
                 }
             }
         }
     }
     if ($categories) {
         foreach ($categories as $category) {
             $html .= '<a class="label ' . $classes . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("Ver Artigos na Categoria %s", 'envirra'), $category->name)) . '" rel="category">' . $category->cat_name . '</a>';
         }
     }
     echo $html;
 }
コード例 #28
0
ファイル: Plugin.php プロジェクト: quandigital/wp-quan-jobs
 public function singleTemplate($template)
 {
     if (\get_post_type(\get_the_id()) === $this->postType) {
         $template = __DIR__ . '/templates/single-template.php';
     }
     return $template;
 }
コード例 #29
0
ファイル: template-tags.php プロジェクト: carrieforde/School
/**
 * Output the menu post type content.
 *
 * @since 1.0.0
 */
function school_menu_output()
{
    $menus = get_post_meta(get_the_id(), 'menus', true);
    if ($menus) {
        echo '<div class="school-menu-wrapper">';
        for ($i = 0; $i < $menus; $i++) {
            $course = get_post_meta(get_the_id(), 'menus_' . $i . '_course', true);
            $menu_item = get_post_meta(get_the_id(), 'menus_' . $i . '_menu_item_name', true);
            $price = get_post_meta(get_the_id(), 'menus_' . $i . '_price', true);
            $source = get_post_meta(get_the_id(), 'menus_' . $i . '_source', true);
            $description = get_post_meta(get_the_id(), 'menus_' . $i . '_menu_item_description', true);
            if (!empty($course)) {
                echo '<h2 class="school-menu-course">' . esc_attr($course) . '</h2>';
            }
            echo '<h3 class="school-menu-item-heading">';
            echo '<span class"school-menu-item">' . esc_attr($menu_item) . '</span>';
            echo '<span class="school-menu-price">' . esc_attr($price) . '</span>';
            echo '</h3>';
            if (!empty($source)) {
                echo '<p class="school-menu-source">' . esc_attr($source) . '</p>';
            }
            echo '<p class="school-menu-description">' . esc_attr($description) . '</p>';
        }
        echo '</div>';
    }
}
コード例 #30
0
ファイル: PostFavorites.php プロジェクト: andyUA/kabmin-new
 public function __construct($post_id, $site_id)
 {
     $this->post_id = $post_id ? $post_id : get_the_id();
     $this->site_id = $site_id ? $site_id : 1;
     $this->user_repo = new UserRepository();
     $this->favorite_count = new FavoriteCount();
 }