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

PHP wp_audio_shortcode函数代码示例

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

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



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

示例1: cap_podcast_player

/**
* We're going to override the_content through a filter.
*/
function cap_podcast_player($id = null, $player_type = 'default')
{
    if (empty($id)) {
        $post_id = get_the_ID();
    } else {
        $post_id = $id;
    }
    $episode_number = get_post_meta($post_id, 'episode_number', true);
    // Get Episode Media Source
    $episode_attachment_id = get_post_meta($post_id, 'episode_file', true);
    $episode_external_file = get_post_meta($post_id, 'external_episode_file', true);
    if (!empty($episode_attachment_id)) {
        $player_src = wp_get_attachment_url($episode_attachment_id);
    } elseif (!empty($episode_external_file)) {
        $player_src = $episode_external_file;
    }
    $attr = array('src' => '' . $player_src . '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata');
    $player = wp_audio_shortcode($attr);
    $download_link = '<small><a href="' . $player_src . '" download="episode' . $episode_number . '.mp3">Download this Episode</a></small>';
    // Get Episode Artwork //
    $episode_artwork_id = get_post_thumbnail_id($post_id);
    $episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail');
    $episode_artwork_src = $episode_artwork[0];
    if ('default' == $player_type) {
        $episode_title = '
        <div class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
        </div>
        ';
    } elseif ('large' == $player_type) {
        $post_object = get_post($post_id);
        $episode_title = '
        <a href="' . get_permalink($post_id) . '" class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
            <span class="description">' . wp_trim_words($post_object->post_content, '60') . '</span>
        </a>
        ';
    } elseif ('mini' == $player_type) {
        $episode_title = '';
    }
    // Construct Markup
    $markup = '
    <div class="episode-header">
        <div class="episode-artwork-container">
            <div class="episode-artwork" style="background-image: url(' . $episode_artwork_src . ');">
                <div id="play-episode" class="maintain-ratio">
                    <span class="dashicons"></span>
                </div>
            </div>
        </div>
        ' . $episode_title . '
    </div>';
    $script = "\n    <script type='text/javascript'>\n    var playerID = jQuery('#episode-" . $episode_number . "-" . $post_id . " audio').attr('id');\n    var player" . $post_id . " = document.getElementById(playerID);\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function(){\n        jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').toggleClass('paused');\n    });\n\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function() {\n\n        if ( jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".play();\n        }\n\n        if ( !jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".pause();\n        }\n\n    });\n    </script>\n    ";
    if (function_exists('cap_podcast_player_colors')) {
        $player .= cap_podcast_player_colors($post_id);
    }
    return '<div id="episode-' . $episode_number . '-' . $post_id . '" class="podcast-player ' . $player_type . '">' . $markup . $player . $download_link . $script . '</div>';
}
开发者ID:amprog,项目名称:cap-podcaster,代码行数:63,代码来源:single-episode-template.php


示例2: test_fix_audio_shortcode

 /**
  * @covers \PressBooks\Sanitize\fix_audio_shortcode
  */
 public function test_fix_audio_shortcode()
 {
     \PressBooks\Sanitize\fix_audio_shortcode();
     $this->assertTrue(has_filter('wp_audio_shortcode'));
     // Verify that style attribute is empty.
     $var = wp_audio_shortcode(array('src' => 'http://foo/audio.mp3'));
     $this->assertContains('style=""', $var);
 }
开发者ID:cumi,项目名称:pressbooks,代码行数:11,代码来源:test-sanitize.php


示例3: get_html

 public function get_html($media)
 {
     if (!$media) {
         return '';
     }
     $html = '';
     $args = array('src' => mpp_get_media_src(), 'loop' => false, 'autoplay' => false);
     return wp_audio_shortcode($args);
 }
开发者ID:baden03,项目名称:mediapress,代码行数:9,代码来源:media-view-audio.php


示例4: tzp_add_portfolio_post_media

/**
 * This will add portfolio media content to the start of the content
 * Override this functionality in a theme by removing the filter.
 * 
 * @param  string $content The content
 * @return string          The updated content
 */
function tzp_add_portfolio_post_media($content)
{
    global $post;
    if ($post->post_type == 'portfolio') {
        $display_gallery = get_post_meta($post->ID, '_tzp_display_gallery', true);
        $display_audio = get_post_meta($post->ID, '_tzp_display_audio', true);
        $display_video = get_post_meta($post->ID, '_tzp_display_video', true);
        if ($display_gallery || $display_audio || $display_video) {
            $output = '<div class="portfolio-media">';
            if ($display_gallery) {
                $output .= tzp_portfolio_gallery($post->ID);
            }
            if ($display_audio) {
                $poster = get_post_meta($post->ID, '_tzp_audio_poster_url', true);
                if ($poster) {
                    $output .= sprintf('<img src="%1$s" alt="" />', esc_url($poster));
                }
                $mp3 = get_post_meta($post->ID, '_tzp_audio_file_mp3', true);
                $ogg = get_post_meta($post->ID, '_tzp_audio_file_ogg', true);
                $attr = array('mp3' => $mp3, 'ogg' => $ogg);
                $output .= wp_audio_shortcode($attr);
            }
            if ($display_video) {
                $embed = get_post_meta($post->ID, '_tzp_video_embed', true);
                if ($embed) {
                    $output .= html_entity_decode(esc_html($embed));
                } else {
                    $poster = get_post_meta($post->ID, '_tzp_video_poster_url', true);
                    $m4v = get_post_meta($post->ID, '_tzp_video_file_m4v', true);
                    $ogv = get_post_meta($post->ID, '_tzp_video_file_ogv', true);
                    $mp4 = get_post_meta($post->ID, '_tzp_video_file_mp4', true);
                    $attr = array('poster' => $poster, 'm4v' => $m4v, 'ogv' => $ogv, 'mp4' => $mp4);
                    $output .= wp_video_shortcode($attr);
                }
            }
            $output .= '</div>';
            return $output . $content;
        }
        return $content;
    } else {
        return $content;
    }
}
开发者ID:TyRichards,项目名称:paradox,代码行数:50,代码来源:functions.php


示例5: front_main

    public static function front_main($data)
    {
        $data->name = __CLASS__;
        ?>
		<div id="module-<?php 
        echo $data->ID;
        ?>
" class="<?php 
        echo $data->name;
        ?>
 front-single-module<?php 
        echo audio_module::FRONT_SAVE == true ? '-save' : '';
        ?>
">
			<?php 
        if ($data->post_title != '' && parent::display_title_on_front($data)) {
            ?>
				<h2 class="module_title"><?php 
            echo $data->post_title;
            ?>
</h2>
			<?php 
        }
        ?>

			<?php 
        if ($data->audio_url != '') {
            ?>
				<div class="audio_player">
					<?php 
            $attr = array('src' => $data->audio_url, 'loop' => checked($data->loop, 'Yes', false) ? 'on' : '', 'autoplay' => checked($data->autoplay, 'Yes', false) ? 'on' : '');
            echo wp_audio_shortcode($attr);
            ?>
				</div>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:40,代码来源:audio.php


示例6: get_files_array

 /**
  * Return an array of files prepared for output.
  *
  * Processes files by file type and generates unique output for each.
  *
  * Returns array for each file, with the following keys:
  *
  * `file_path` => The file path of the file, with a line break
  * `html` => The file output HTML formatted
  *
  * @since  1.2
  * @todo  Support `playlist` shortcode for playlist of video/audio
  * @usedby gravityview_get_files_array()
  * @param  string $value    Field value passed by Gravity Forms. String of file URL, or serialized string of file URL array
  * @param  string $gv_class Field class to add to the output HTML
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
  */
 static function get_files_array($value, $gv_class)
 {
     $gravityview_view = GravityView_View::getInstance();
     extract($gravityview_view->getCurrentField());
     $output_arr = array();
     // Get an array of file paths for the field.
     $file_paths = rgar($field, 'multipleFiles') ? json_decode($value) : array($value);
     // Process each file path
     foreach ($file_paths as $file_path) {
         // If the site is HTTPS, use HTTPS
         if (function_exists('set_url_scheme')) {
             $file_path = set_url_scheme($file_path);
         }
         // This is from Gravity Forms's code
         $file_path = esc_attr(str_replace(" ", "%20", $file_path));
         // If the field is set to link to the single entry, link to it.
         $link = !empty($field_settings['show_as_link']) ? GravityView_API::entry_link($entry, $field) : $file_path;
         // Get file path information
         $file_path_info = pathinfo($file_path);
         $html_format = NULL;
         $disable_lightbox = false;
         $disable_wrapped_link = false;
         // Is this an image?
         $image = new GravityView_Image(array('src' => $file_path, 'class' => 'gv-image gv-field-id-' . $field_settings['id'], 'alt' => $field_settings['label'], 'width' => gravityview_get_context() === 'single' ? NULL : 250));
         $content = $image->html();
         // The new default content is the image, if it exists. If not, use the file name as the content.
         $content = !empty($content) ? $content : $file_path_info['basename'];
         // If pathinfo() gave us the extension of the file, run the switch statement using that.
         $extension = empty($file_path_info['extension']) ? NULL : strtolower($file_path_info['extension']);
         switch (true) {
             // Audio file
             case in_array($extension, wp_get_audio_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('audio')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $audio_settings = apply_filters('gravityview_audio_settings', array('src' => $file_path, 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the audio shortcode
                      * @link http://codex.wordpress.org/Audio_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
                      */
                     $content = wp_audio_shortcode($audio_settings);
                 }
                 break;
                 // Video file
             // Video file
             case in_array($extension, wp_get_video_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('video')) {
                     $disable_wrapped_link = true;
                     /**
                      * Modify the settings passed to the `wp_video_shortcode()` function
                      *
                      * @since  1.2
                      * @var array
                      */
                     $video_settings = apply_filters('gravityview_video_settings', array('src' => $file_path, 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the video shortcode
                      * @link http://codex.wordpress.org/Video_Shortcode
                      * @link https://developer.wordpress.org/reference/functions/wp_video_shortcode/
                      */
                     $content = wp_video_shortcode($video_settings);
                 }
                 break;
                 // PDF
             // PDF
             case $extension === 'pdf':
                 // PDF needs to be displayed in an IFRAME
                 $link = add_query_arg(array('TB_iframe' => 'true'), $link);
                 break;
                 // if not image, do not set the lightbox (@since 1.5.3)
             // if not image, do not set the lightbox (@since 1.5.3)
             case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
                 $disable_lightbox = true;
                 break;
         }
//.........这里部分代码省略.........
开发者ID:psdes,项目名称:GravityView,代码行数:101,代码来源:fileupload.php


示例7: base_print_audio_html

 /**
  * Prints the WP Audio Shortcode to output the HTML for audio
  * @param  int $postid The post ID
  * @return string         The "hmtl" for printing audio elements
  */
 function base_print_audio_html($postid)
 {
     $output = '';
     $posttype = get_post_type($postid);
     $keys = array('post' => array('mp3' => '_zilla_audio_mp3', 'ogg' => '_zilla_audio_ogg'), 'portfolio' => array('mp3' => '_tzp_audio_file_mp3', 'ogg' => '_tzp_audio_file_ogg'));
     // Print an image if needed
     if ($posttype == 'portfolio') {
         $img = get_post_meta($postid, '_tzp_audio_poster_url', true);
         if ($img) {
             $output .= '<img src="' . esc_url_raw($img) . '" alt="' . esc_attr(get_the_title($postid)) . '" />';
         }
     } elseif (has_post_thumbnail($postid)) {
         $size = 'post-thumbnail';
         if (is_singular()) {
             $size = 'full';
         }
         $output .= get_the_post_thumbnail($postid, $size);
     }
     // Build the "shortcode"
     $mp3 = get_post_meta($postid, $keys[$posttype]['mp3'], true);
     $ogg = get_post_meta($postid, $keys[$posttype]['ogg'], true);
     $attr = array();
     if ($mp3) {
         $attr['mp3'] = $mp3;
     }
     if ($ogg) {
         $attr['ogg'] = $ogg;
     }
     $output .= wp_audio_shortcode($attr);
     return $output;
 }
开发者ID:TyRichards,项目名称:paradox,代码行数:36,代码来源:template-tags.php


示例8: powerpressplayer_build_mediaelementaudio

function powerpressplayer_build_mediaelementaudio($media_url, $EpisodeData = array(), $embed = false)
{
    if (!function_exists('wp_audio_shortcode')) {
        // Return the HTML5 audio shortcode instead
        return powerpressplayer_build_html5audio($media_url, $EpisodeData, $embed);
    }
    $player_id = powerpressplayer_get_next_id();
    $autoplay = false;
    // Episode Settings
    if (!empty($EpisodeData['autoplay'])) {
        $autoplay = true;
    }
    $content = '';
    $content .= '<div class="powerpress_player" id="powerpress_player_' . $player_id . '">' . PHP_EOL;
    $attr = array('src' => $media_url, 'loop' => '', 'autoplay' => $autoplay ? 'on' : '', 'preload' => 'none');
    $content .= wp_audio_shortcode($attr);
    $content .= '</div>' . PHP_EOL;
    return $content;
}
开发者ID:briancfeeney,项目名称:portigal,代码行数:19,代码来源:powerpress-player.php


示例9: elseif

             break;
     }
 } elseif ('audio' == $media['type']) {
     switch ($media['audio_type']) {
         case 'embed':
             global $wp_embed;
             if (is_a($wp_embed, 'WP_Embed')) {
                 echo $wp_embed->autoembed($media['audio_embed']);
             } else {
                 echo $media['audio_embed'];
             }
             break;
         case 'hosted':
             // Check if the attachment is an audio
             if (0 === strpos(get_post_mime_type($media['audio_src']), 'audio/')) {
                 echo wp_audio_shortcode(array('src' => wp_get_attachment_url($media['audio_src'])));
             }
             break;
     }
 } else {
     $attachments = array();
     foreach ($media['images'] as $image) {
         if ($attachment = wp_get_attachment_image_src($image, 'full')) {
             $attachments[$image] = $attachment;
         }
     }
     switch ($media['type']) {
         case 'slider':
             echo '<div class="royalSlider rsHelium" data-rs-settings="' . esc_attr(helium_rs_settings($media)) . '">';
             foreach ($attachments as $id => $attachment) {
                 echo wp_get_attachment_image($id, 'full', false, array('class' => 'attachment-full rsImg', 'data-rsw' => $attachment[1], 'data-rsh' => $attachment[2]));
开发者ID:yemingyuen,项目名称:mingsg,代码行数:31,代码来源:entry.php


示例10: elseif

        echo "<li><img src='{$item}' alt='' /></li>";
    }
    echo "</ul>";
} elseif ($format === "video" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    echo "<div class='dt-video-wrap'>";
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_video_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
    echo "</div>";
} elseif ($format === "audio" && (array_key_exists('oembed-url', $tpl_default_settings) || array_key_exists('self-hosted-url', $tpl_default_settings))) {
    if (array_key_exists("oembed-url", $tpl_default_settings)) {
        echo wp_oembed_get($tpl_default_settings['oembed-url']);
    } elseif (array_key_exists("self-hosted-url", $tpl_default_settings)) {
        echo wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
    }
} elseif (!array_key_exists("disable-featured-image", $tpl_default_settings)) {
    ?>
                  	<a href="<?php 
    the_permalink();
    ?>
" title="<?php 
    printf(esc_attr__('%s'), the_title_attribute('echo=0'));
    ?>
"><?php 
    if (has_post_thumbnail()) {
        the_post_thumbnail("full");
    } elseif ($pholder != "on") {
        ?>
                        	<img src="http://placehold.it/1170x822&text=Image" alt="<?php 
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:31,代码来源:content-single.php


示例11: getIncidentMediaHtml

 /**
  * Gets the correct HTML embeds/elements for a given media type.
  *
  * @param string $type One of 'video', 'audio', or 'image'
  * @param int $post_id The WP post ID of the attachment media.
  *
  * @return string
  */
 private static function getIncidentMediaHtml($type, $post_id)
 {
     $html = '';
     switch ($type) {
         case 'video':
             $html .= wp_video_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
         case 'image':
             $html .= '<a href="' . wp_get_attachment_url($post_id) . '" target="_blank">';
             $html .= wp_get_attachment_image($post_id);
             $html .= '</a>';
             break;
         case 'audio':
         default:
             $html .= wp_audio_shortcode(array('src' => wp_get_attachment_url($post_id)));
             break;
     }
     return $html;
 }
开发者ID:anhquan0412,项目名称:better-angels,代码行数:27,代码来源:class-buoy-alert.php


示例12: the_permalink

	<a href="<?php 
the_permalink();
?>
" title="<?php 
the_title_attribute();
?>
">
		<span class="fui-volume"></span> <?php 
the_title();
?>
	</a>
</h2>
<div class="col-sm-4 col-md-2 col-lg-4">
<?php 
$attr = array('src' => $post->guid, 'loop' => 'off', 'preload' => 'metadata');
echo wp_audio_shortcode($attr);
$post_ancestors = get_post_ancestors($post);
foreach ($post_ancestors as $post_ancestor) {
    $ancestor = get_post($post_ancestor);
    _e('From', 'citypress');
    ?>
: <a href="<?php 
    echo get_permalink($post_ancestor);
    ?>
" title="<?php 
    echo apply_filters('the_title_attribute', $ancestor->post_title);
    ?>
">
	<?php 
    echo apply_filters('the_title', $ancestor->post_title);
    ?>
开发者ID:jimmyandrade,项目名称:citypress-council,代码行数:31,代码来源:loop-page-audio.php


示例13: the_post

    the_post();
    $metadata = wp_get_attachment_metadata();
    ?>
				<article <?php 
    post_class();
    ?>
>
					<header class="entry-header">
						<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
					</header><!-- .entry-header -->
					<div class="entry-content entry-attachment">
						<?php 
    echo wp_audio_shortcode(array('src' => wp_get_attachment_url()));
    ?>

						<p><strong><?php 
    _e('URL:', 'odin');
    ?>
</strong> <a href="<?php 
    echo esc_url(wp_get_attachment_url());
    ?>
" title="<?php 
    the_title_attribute();
    ?>
" rel="attachment"><span><?php 
    echo esc_attr(basename(wp_get_attachment_url()));
    ?>
</span></a></p>
开发者ID:rodrigo-brito,项目名称:odin,代码行数:31,代码来源:audio.php


示例14: test_wp_audio_shortcode_attributes

 /**
  * @ticket 35367
  */
 function test_wp_audio_shortcode_attributes()
 {
     $actual = wp_audio_shortcode(array('src' => 'https://example.com/foo.mp3'));
     $this->assertContains('src="https://example.com/foo.mp3', $actual);
     $this->assertNotContains('loop', $actual);
     $this->assertNotContains('autoplay', $actual);
     $this->assertContains('preload="none"', $actual);
     $this->assertContains('class="wp-audio-shortcode"', $actual);
     $this->assertContains('style="width: 100%;"', $actual);
     $actual = wp_audio_shortcode(array('src' => 'https://example.com/foo.mp3', 'loop' => true, 'autoplay' => true, 'preload' => true, 'class' => 'foobar', 'style' => 'padding:0;'));
     $this->assertContains('src="https://example.com/foo.mp3', $actual);
     $this->assertContains('loop="1"', $actual);
     $this->assertContains('autoplay="1"', $actual);
     $this->assertContains('preload="1"', $actual);
     $this->assertContains('class="foobar"', $actual);
     $this->assertContains('style="padding:0;"', $actual);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:20,代码来源:media.php


示例15: pods_audio

/**
 * Output an audio field as a video player.
 *
 * @uses wp_audio_shortcode()
 *
 * @since 2.5
 *
 * @param string|array   $url   Can be a URL of the source file, or a Pods audio field.
 * @param bool|array     $args  Optional. Additional arguments to pass to wp_audio_shortcode
 *
 * @return string
 */
function pods_audio($url, $args = false)
{
    if (is_array($url)) {
        if (!is_null(pods_v('ID', $url))) {
            $id = pods_v('ID', $url);
            $url = wp_get_attachment_url($id);
        } else {
            return;
        }
    }
    $audio_args = array('src' => $url);
    if (is_array($args)) {
        $audio_args = array_merge($audio_args, $args);
    }
    return wp_audio_shortcode($args);
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:28,代码来源:media.php


示例16: audio_player

 /**
  * Load audio player for given file
  * @param  string $src Source of audio file
  * @return mixed       Audio player HTML on success, false on failure
  */
 public function audio_player($src = '')
 {
     if ($src) {
         return wp_audio_shortcode(array('src' => $src));
     }
     return false;
 }
开发者ID:evinw,项目名称:project_gg_studios,代码行数:12,代码来源:class-ssp-frontend.php


示例17: pod_featured_multimedia

    function pod_featured_multimedia($post_id)
    {
        global $post;
        $plugin_inuse = get_pod_plugin_active();
        $post_format = get_post_format($post_id);
        $pod_featured_excerpt = pod_theme_option('pod-frontpage-fetured-ex');
        $post_featured_media = '';
        if ($plugin_inuse == 'ssp') {
            $pod_fh_heading = pod_theme_option('pod-featured-heading');
            $id = get_the_ID();
            $file = get_post_meta($post_id, 'enclosure', true);
            $terms = wp_get_post_terms($post_id, 'series');
            foreach ($terms as $term) {
                $series_id = $term->term_id;
                $series = $term->name;
                break;
            }
            $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
            $post_featured_media .= pod_explicit_post($post->ID);
            $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
            if ($file != '') {
                $post_featured_media .= '<div class="audio"><div class="audio_player">' . do_shortcode('[audio src="' . $file . '"][/audio]') . '</div><!--audio_player--></div><!-- .audio -->';
            } else {
                $post_featured_media .= '';
            }
            if ($pod_featured_excerpt == true) {
                $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                $post_featured_media .= get_the_excerpt();
                $post_featured_media .= '<a href="' . get_permalink() . '" class="more-link">';
                $post_featured_media .= __(' Read More', 'thstlang');
                $post_featured_media .= '<span class="meta-nav"></span>
								</a>';
                $post_featured_media .= '</div>';
            }
        } elseif ($plugin_inuse == 'bpp') {
            $pod_fh_heading = pod_theme_option('pod-featured-heading');
            $pp_audio_str = get_post_meta($post_id, 'enclosure', true);
            $pp_audiourl = strtok($pp_audio_str, "\n");
            $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
            $post_featured_media .= pod_explicit_post($post->ID);
            $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
            if ($pp_audiourl != '') {
                $post_featured_media .= get_the_powerpress_content();
            }
            if ($pod_featured_excerpt == true) {
                $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                $post_featured_media .= get_the_excerpt();
                $post_featured_media .= '<a href="' . get_permalink() . '" class="more-link">';
                $post_featured_media .= __(' Read More', 'thstlang');
                $post_featured_media .= '<span class="meta-nav"></span>
								</a>';
                $post_featured_media .= '</div>';
            }
        } else {
            if ($post_format == 'audio') {
                $audiourl = get_post_meta($post_id, 'cmb_thst_audio_url', true);
                $audioembed = get_post_meta($post_id, 'cmb_thst_audio_embed', true);
                $audioembedcode = get_post_meta($post_id, 'cmb_thst_audio_embed_code', true);
                $audiocapt = get_post_meta($post_id, 'cmb_thst_audio_capt', true);
                $audioplists = get_post_meta($post_id, 'cmb_thst_audio_playlist', true);
                $au_uploadcode = wp_audio_shortcode($audiourl);
                $audioex = get_post_meta($post_id, 'cmb_thst_audio_explicit', true);
                $options = get_option('podcaster-theme');
                $pod_fh_heading = isset($options['pod-featured-heading']) ? $options['pod-featured-heading'] : '';
                $excerpt_count = get_post_meta($post_id, 'cmb_thst_featured_post_excerpt_count', true);
                $has_excerpt = get_post_meta($post_id, 'cmb_thst_feature_post_excerpt', true);
                $post_object = get_post($post_id);
                $fheader_type = pod_theme_option('pod-featured-header-type');
                if ($fheader_type == 'static') {
                    $post_excerpt = get_the_excerpt();
                } else {
                    if ($has_excerpt == 'on') {
                        if ($post_object->post_excerpt) {
                            $post_excerpt = $post_object->post_excerpt;
                        } elseif (isset($excerpt_count)) {
                            $post_excerpt = pod_flexible_excerpt($post_id, $excerpt_count);
                        } else {
                            $post_excerpt = '';
                        }
                    } else {
                        $post_excerpt = '';
                    }
                }
                if ($audioembed != '') {
                    $file_parts = pathinfo($audioembed);
                    if (array_key_exists("extension", $file_parts)) {
                        $audioembed = '';
                        $au_embedcode = "<p>Please use a valid embed URL. Make sure it doesn't have a file extension, such as *.mp3.</p>";
                    } else {
                        $au_embedcode = wp_oembed_get($audioembed);
                    }
                    $post_featured_media .= '<div class="row">' . pod_the_embed('<span class="mini-title">' . $pod_fh_heading . '</span> ' . pod_explicit_post($post_id) . ' <h2><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h2> <p>' . $post_excerpt . '</p><a class="more-link" href="' . get_permalink($post_id) . '">' . __('Read More', 'thstlang') . '</a>', '<div class="audio_player au_oembed">' . $au_embedcode . '</div><!--audio_player-->') . '</div>';
                } elseif ($audiourl != '') {
                    $post_featured_media .= '<span class="mini-title">' . $pod_fh_heading . '</span>';
                    $post_featured_media .= pod_explicit_post($post->ID);
                    $post_featured_media .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
                    $post_featured_media .= '<div class="audio_player">' . do_shortcode('[audio src="' . $audiourl . '"][/audio]') . '</div><!--audio_player-->';
                    if ($pod_featured_excerpt == true) {
                        $post_featured_media .= '<div class="featured-excerpt ' . $post_format . '">';
                        $post_featured_media .= get_the_excerpt();
//.........这里部分代码省略.........
开发者ID:rmens,项目名称:podcaster,代码行数:101,代码来源:featured-header.php


示例18: cultiv8_the_sermon_details

function cultiv8_the_sermon_details($post_id, $glyph = 'fa')
{
    $classes = array('container' => 'ctcex-sermon-container', 'media' => 'ctcex-sermon-media', 'details' => 'ctcex-sermon-details', 'date' => 'ctcex-sermon-date', 'speaker' => 'ctcex-sermon-speaker', 'series' => 'ctcex-sermon-series', 'topic' => 'ctcex-sermon-topic', 'audio-link' => 'ctcex-sermon-audio-link', 'audio' => 'ctcex-sermon-audio', 'video' => 'ctcex-sermon-video', 'img' => 'ctcex-sermon-img');
    $title = get_the_title($post_id);
    $data = cultiv8_get_sermon_data($post_id);
    // Sermon date
    $date_src = sprintf('<div class="%s"><b>%s:</b> %s</div>', $classes['date'], __('Date', 'ctcex'), get_the_date());
    // Get speaker
    $speaker_src = $data['speakers'] ? sprintf('<div class="%s"><b>%s:</b> %s</div>', $classes['speaker'], __('Speaker', 'ctcex'), $data['speakers']) : '';
    // Get series
    $series_src = $data['series'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['series'], __('Series', 'ctcex'), $data['series_link'], $data['series']) : '';
    // Get topics
    // Topic name
    $topic_name = explode('/', cultiv8_get_option('ctc-sermon-topic', __('Topic', 'ctcex')));
    $topic_name = ucfirst(array_pop($topic_name));
    $topic_src = $data['topic'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['topic'], $topic_name, $data['topic_link'], $data['topic']) : '';
    // Get audio link
    $audio_link_src = $data['audio'] ? sprintf('<div class="%s"><b>%s:</b> <a href="%s">%s</a></div>', $classes['audio-link'], __('Audio', 'ctcex'), $data['audio'], __('Download audio', 'ctcex')) : '';
    // Get audio display
    $audio_src = $data['audio'] ? sprintf('<div class="%s">%s</div>', $classes['audio'], wp_audio_shortcode(array('src' => $data['audio']))) : '';
    // Get video display
    $video_iframe_class = strripos($data['video'], 'iframe') ? 'iframe-container' : '';
    $video_src = $data['video'] ? sprintf('<div class="%s %s">%s</div>', $classes['video'], $video_iframe_class, $video_iframe_class ? $data['video'] : wp_video_shortcode(array('src' => $data['video']))) : '';
    // Use the image as a placeholder for the video
    $img_overlay_class = $data['video'] && $data['img'] ? 'ctcex-overlay' : '';
    $img_overlay_js = $img_overlay_class ? sprintf('<div class="ctcex-overlay">
			<i class="' . ($glyph === 'gi' ? 'genericon genericon-play' : 'fa fa-play') . '"></i>
		</div>
		<script>
			jQuery(document).ready( function($) {
				$( ".%s" ).css( "position", "relative" );
				$( ".ctcex-overlay" ).css( "cursor", "pointer" );
				var vid_src = \'%s\';
				vid_src = vid_src.replace( "autoPlay=false", "autoPlay=true" );
				$( ".ctcex-overlay" ).click( function(){
					$( this ).hide();
					$( ".ctcex-sermon-img" ).fadeOut( 200, function() {
						$( this ).replaceWith( vid_src );
						$( ".%s").addClass( "video_loaded" );
					});
				} );
			})
		</script>', $classes['media'], $video_src, $classes['media']) : '';
    // Get image
    $img_src = $data['img'] ? sprintf('%s<img class="%s" src="%s" alt="%s" width="960"/>', $img_overlay_js, $classes['img'], $data['img'], get_the_title()) : '';
    $video_src = $img_overlay_class ? $img_src : $video_src;
    $img_video_output = $video_src ? $video_src : $img_src . $audio_src;
    $names = cultiv8_get_option('ctc-sermons', __('sermons/sermon', 'cultiv8'));
    $plural_name = explode('/', strtolower($names));
    $single_name = array_pop($plural_name);
    // Prepare output
    $item_output = sprintf('<div class="%s">
			<div class="%s">%s</div>
			<div class="%s">
				%s
				%s
				%s
				%s
				%s
			</div>
		', $classes['container'], $classes['media'], $img_video_output, $classes['details'], $date_src, $speaker_src, $series_src, $topic_src, $audio_link_src);
    echo $item_output;
}
开发者ID:serranoabq,项目名称:cultiv8,代码行数:63,代码来源:ctc-support.php


示例19: get_audio

 /**
  * Retrieve audio related to a post.
  *
  * @since 3.1.0
  * @uses $wp_embed
  * @todo Consider using get_enclosed(), too?
  * @todo Add support for the Crowd Favorite dealio.
  *
  * @param  int|WP_Post Optional. Post ID or object. Defaults to the current post in the loop.
  * @return string      HTML <audio> tag or empty string.
  */
 public function get_audio($post = 0)
 {
     global $wp_embed;
     $return_false_on_fail = $wp_embed->return_false_on_fail;
     $wp_embed->return_false_on_fail = true;
     $html = '';
     $post = get_post($post);
     // Extract an [audio] shortcode from the post content.
     if (has_shortcode($post->post_content, 'audio')) {
         if (preg_match_all('/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER)) {
             foreach ($matches as $shortcode) {
                 if ('audio' === $shortcode[2]) {
                     $html = do_shortcode($shortcode);
                     break;
                 }
             }
         }
     }
     // Check for autoembeds (links on their own lines) in the post content.
     if (empty($html) && preg_match_all('|^\\s*(https?://[^\\s"]+)\\s*$|im', $post->post_content, $matches)) {
         foreach ($matches[1] as $url) {
             $result = $wp_embed->shortcode(array(), $url);
             if (0 === strpos($result, '[audio')) {
                 $html = do_shortcode($result);
                 break;
             }
         }
     }
     // Check for audio attachments.
     if (empty($html)) {
         $attachments = get_posts(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'posts_per_page' => 1, 'fields' => 'ids', 'orderby' => 'menu_order', 'order' => 'asc'));
         if (!empty($attachments)) {
             $src = wp_get_attachment_url($attachments[0]);
             $html = wp_audio_shortcode(array('src' => $src));
         }
     }
     // Extract <audio> tags from the post content.
     if (empty($html)) {
         $embedded = get_media_embedded_in_content($post->post_content, array('audio'));
         $html = empty($embedded[0]) ? '' : $embedded[0];
     }
     // Reset the WP_Embed::return_false_on_fail setting.
     $wp_embed->return_false_on_fail = $return_false_on_fail;
     return apply_filters($this->theme->prefix . '_post_audio', $html, $post);
 }
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:56,

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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