• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_the_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_the_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_id函数的具体用法?PHP get_the_id怎么用?PHP get_the_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_the_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: fpw_excerpt

/**
 * 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;
}
开发者ID:alphacityco,项目名称:kotobanokumo-wp-content,代码行数:38,代码来源:fpw_template_filters.php


示例2: salesforce_w2l_lead_source_example

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;
}
开发者ID:jiwicky,项目名称:salesforce-wordpress-to-lead,代码行数:7,代码来源:examples.php


示例3: rum_post_cta_meta_box_list

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;
}
开发者ID:rumspeed,项目名称:post-call-to-action,代码行数:32,代码来源:metabox.php


示例4: get_related_posts

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;
}
开发者ID:philwp,项目名称:wp-pitt-related,代码行数:29,代码来源:wp-pitt-related.php


示例5: friend_list_func

    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;
    }
开发者ID:HealthyWebDeveloper,项目名称:HWD-friend-finder,代码行数:26,代码来源:class-friend-shortcode.php


示例6: register

 /**
  * 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;
 }
开发者ID:WPTie,项目名称:VRCore,代码行数:39,代码来源:class-agent-meta-boxes.php


示例7: ac_remove_wpautop

/**
 *
 */
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');
    }
}
开发者ID:ambercouch,项目名称:wp-ac-remove-autop,代码行数:10,代码来源:actions.php


示例8: go

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
    //##############################################################
}
开发者ID:rubulh,项目名称:ants,代码行数:25,代码来源:go.php


示例9: migrate

 /**
  * 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"));
             }
         }
     }
 }
开发者ID:trepmal,项目名称:wp-cli-meta-to-term,代码行数:50,代码来源:meta-to-term-cli.php


示例10: getPriceWithLabel

 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;
 }
开发者ID:dorkyhuman,项目名称:things,代码行数:27,代码来源:FmFunction.php


示例11: wp_nav_menu_objects_filter

 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;
 }
开发者ID:JeffreyBue,项目名称:jb,代码行数:28,代码来源:PeThemeVisia.php


示例12: add_snippet

 /**
  * 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;
 }
开发者ID:s3rgiosan,项目名称:wpsmartlook,代码行数:30,代码来源:Frontend.php


示例13: instapaper_button

/**
 * 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;
}
开发者ID:rmccue,项目名称:Lilina,代码行数:13,代码来源:instapaper.php


示例14: gs_logo_shortcode

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;
}
开发者ID:bunnywong,项目名称:freshlinker,代码行数:34,代码来源:gs-logo-shortcode.php


示例15: impronta_metadata

 /**
  * 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>';
     }
 }
开发者ID:nicoandrade,项目名称:Impronta,代码行数:36,代码来源:template-tags.php


示例16: widget

 /** @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;
 }
开发者ID:meta4creations,项目名称:mtphr-galleries,代码行数:61,代码来源:widget-data.php


示例17: mtphr_dnt_content

function mtphr_dnt_content($content)
{
    if (get_post_type() == 'ditty_news_ticker') {
        return '[ditty_news_ticker id="' . get_the_id() . '"]';
    }
    return $content;
}
开发者ID:serker72,项目名称:T3S,代码行数:7,代码来源:filters.php


示例18: if_download_price_function

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();
}
开发者ID:Bento4Extend,项目名称:EDD-Download-Shortcodes,代码行数:32,代码来源:if_download_price.php


示例19: prettyfilelist_shortcode

 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;
 }
开发者ID:MarcSky,项目名称:pretty-file-lister,代码行数:27,代码来源:PrettyFileList.php


示例20: vntd_testimonials

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;
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:60,代码来源:carousel-testimonials.php



注:本文中的get_the_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_the_image函数代码示例发布时间:2022-05-15
下一篇:
PHP get_the_guid函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap