本文整理汇总了PHP中the_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP the_meta函数的具体用法?PHP the_meta怎么用?PHP the_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_meta函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cftpb_term_the_meta
function cftpb_term_the_meta($term_id, $taxonomy)
{
global $post;
$term_post = cf_taxonomy_post_type_binding::get_term_post($term_id, $taxonomy);
if (!empty($term_post) && !is_wp_error($term_post)) {
$pre_post_state = $post;
$post = $term_post;
the_meta();
$post = $pre_post_state;
}
}
示例2: storefront_post_content
/**
* Display the post content with a link to the single post
* @since 1.0.0
*/
function storefront_post_content() {
?>
<div class="entry-content" itemprop="articleBody">
<?php
storefront_post_thumbnail( 'full' );
the_meta();
the_content(
sprintf(
__( 'Continue reading %s', 'storefront' ),
'<span class="screen-reader-text">' . get_the_title() . '</span>'
)
);
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php
}
示例3: contents_cfinfobox
function contents_cfinfobox()
{
//set up variables
$pageid = get_the_ID();
//get page ID
$objectfetch = get_option("widget_cfinfobox");
//object types from setting
$objectposttype = $objectfetch['posttype'];
$objectkeyword = $objectfetch['category'];
$objectelsetext = $objectfetch['elsetext'];
$ancestorarray = get_ancestors($pageid, $objectposttype);
//foreach($ancestorarray as $ancestor){
//echo $ancestor}
//do they match?)
if (in_array($objectkeyword, $ancestorarray)) {
echo '<h3>' . get_the_title() . '</h3>';
//display page title
echo '<p>' . the_meta() . '</p>';
} else {
echo $objectelsetext;
}
}
示例4: the_title
<h1><?php
the_title();
?>
</h1>
<div id="music"></div>
<div class="entry">
<?php
the_content('<p>leggi il seguito... »</p>');
?>
<div style="font-size:18px; color:#000"><?php
echo get_post_meta($post->ID, 'data', true);
?>
</div>
<?php
the_meta();
?>
<?php
wp_link_pages(array('before' => '<p><strong>' . __('Pagine:', 'kubrick') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
?>
<?php
}
}
?>
</div>
</div>
<div class="clearall"></div>
示例5: insertPages_handleShortcode_insert
//.........这里部分代码省略.........
break;
case "all":
// Title.
$title_tag = $attributes['inline'] ? 'span' : 'h1';
echo "<{$title_tag} class='insert-page-title'>";
echo get_the_title($inserted_page->ID);
echo "</{$title_tag}>";
// Content.
$content = get_post_field('post_content', $inserted_page->ID);
if ($attributes['should_apply_the_content_filter']) {
$content = apply_filters('the_content', $content);
}
echo $content;
// Meta.
// @ref https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/post-template.php#L968
if ($keys = get_post_custom_keys($inserted_page->ID)) {
echo "<ul class='post-meta'>\n";
foreach ((array) $keys as $key) {
$keyt = trim($key);
if (is_protected_meta($keyt, 'post')) {
continue;
}
$values = array_map('trim', get_post_custom_values($key));
$value = implode($values, ', ');
/**
* Filter the HTML output of the li element in the post custom fields list.
*
* @since 2.2.0
*
* @param string $html The HTML output for the li element.
* @param string $key Meta key.
* @param string $value Meta value.
*/
echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>{$key}:</span> {$value}</li>\n", $key, $value);
}
echo "</ul>\n";
}
break;
default:
// display is either invalid, or contains a template file to use
// Legacy/compatibility code: In order to use custom templates,
// we use query_posts() to provide the template with the global
// state it requires for the inserted page (in other words, all
// template tags will work with respect to the inserted page
// instead of the parent page / main loop). Note that this may
// cause some compatibility issues with other plugins.
// @ref https://codex.wordpress.org/Function_Reference/query_posts
if (is_numeric($attributes['page'])) {
$args = array('p' => intval($attributes['page']), 'post_type' => get_post_types());
} else {
$args = array('name' => esc_attr($attributes['page']), 'post_type' => get_post_types());
}
$inserted_page = query_posts($args);
if (have_posts()) {
$template = locate_template($attributes['display']);
if (strlen($template) > 0) {
include $template;
// execute the template code
} else {
// Couldn't find template, so fall back to printing a link to the page.
the_post();
?>
<a href="<?php
the_permalink();
?>
"><?php
示例6: array
// WP_Query arguments
$args = array('post_type' => array('latest-activity'), 'meta_query' => array(array('key' => 'activity')));
// The Query
$latest_activity = new WP_Query($args);
if ($latest_activity->have_posts()) {
?>
<!-- the loop -->
<?php
while ($latest_activity->have_posts()) {
$latest_activity->the_post();
?>
<div class="col-sm-6 col-md-3">
<div class="iframe-respo">
<?php
the_meta('activity');
?>
</div>
</div>
<?php
}
?>
<!-- end of the loop -->
<?php
wp_reset_postdata();
wp_reset_query();
?>
<?php
} else {
示例7: insertPages_handleShortcode_insert
//.........这里部分代码省略.........
the_title();
?>
</a>
<?php
break;
case "excerpt":
the_post();
?>
<h1><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h1>
<?php
if ($should_apply_the_content_filter) {
the_excerpt();
} else {
echo get_the_excerpt();
}
?>
<?php
break;
case "excerpt-only":
the_post();
?>
<?php
if ($should_apply_the_content_filter) {
the_excerpt();
} else {
echo get_the_excerpt();
}
?>
<?php
break;
case "content":
the_post();
?>
<?php
if ($should_apply_the_content_filter) {
the_content();
} else {
echo get_the_content();
}
?>
<?php
break;
case "all":
the_post();
?>
<h1><?php
the_title();
?>
</h1>
<?php
if ($should_apply_the_content_filter) {
the_content();
} else {
echo get_the_content();
}
?>
<?php
the_meta();
?>
<?php
break;
default:
// display is either invalid, or contains a template file to use
$template = locate_template($display);
if (strlen($template) > 0) {
include $template;
// execute the template code
} else {
// Couldn't find template, so fall back to printing a link to the page.
the_post();
?>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a><?php
}
break;
}
$content = ob_get_contents();
// Save off output buffer
ob_end_clean();
// End output buffering
}
wp_reset_postdata();
$wp_query = clone $temp_query;
// Restore main Loop's wp_query
$post = $temp_post;
$content = "<div data-post-id='{$page}' class='insert-page insert-page-{$page} {$class}'>{$content}</div>";
return $content;
//return do_shortcode($content); // careful: watch for infinite loops with nested inserts
}
示例8: bfa_postinfo
//.........这里部分代码省略.........
$postinfo = str_replace("%permalink%", $permalink, $postinfo);
}
// Post ID
if (strpos($postinfo_string, '%post-id%') !== FALSE) {
ob_start();
the_ID();
$post_id = ob_get_contents();
ob_end_clean();
$postinfo = str_replace("%post-id%", $post_id, $postinfo);
}
// Post Title
if (strpos($postinfo_string, '%post-title%') !== FALSE) {
ob_start();
the_title();
$post_title = ob_get_contents();
ob_end_clean();
$postinfo = str_replace("%post-title%", $post_title, $postinfo);
}
// Edit post
if (strpos($postinfo_string, '%edit(') !== FALSE) {
while (strpos($postinfo, '%edit(') !== FALSE) {
$edit_options = preg_match("/(.*)%edit\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $edit_matches);
ob_start();
edit_post_link($edit_matches[4], $edit_matches[2], $edit_matches[6]);
$edit_link = ob_get_contents();
ob_end_clean();
$postinfo = preg_replace("/(.*)%edit\\((.*?)\\)%(.*)/i", "\${1}" . $edit_link . "\${3}", $postinfo);
}
}
// Print
if (strpos($postinfo_string, '%print(') !== FALSE) {
while (strpos($postinfo, '%print(') !== FALSE) {
$print_text = preg_match("/(.*)%print\\('(.*?)'(.*)/i", $postinfo_string, $print_text_matches);
$print_link = '<a href="javascript:window.print()">' . $print_text_matches[2] . '</a>';
$postinfo = preg_replace("/(.*)%print\\((.*?)\\)%(.*)/i", "\${1}" . $print_link . "\${3}", $postinfo);
}
}
// For the "WP-Email" plugin
if (strpos($postinfo_string, '%wp-email%') !== FALSE) {
$wp_email = function_exists('wp_email') ? email_link($email_post_text = '', $email_page_text = '', $echo = FALSE) : "";
$postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
}
// For the "WP-Print" plugin
if (strpos($postinfo_string, '%wp-print%') !== FALSE) {
$wp_print = function_exists('wp_print') ? print_link($print_post_text = '', $print_page_text = '', $echo = FALSE) : "";
$postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
}
// For the "WP-PostViews" plugin
if (strpos($postinfo_string, '%wp-postviews%') !== FALSE) {
$wp_postviews = function_exists('the_views') ? the_views($display = FALSE) : "";
$postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
}
// For the "WP-PostRatings" plugin
if (strpos($postinfo_string, '%wp-postratings%') !== FALSE) {
$wp_postratings = function_exists('the_ratings') ? the_ratings($start_tag = 'span', $custom_id = 0, $display = FALSE) : "";
$postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
}
// For the "Sociable" plugin
if (strpos($postinfo_string, '%sociable%') !== FALSE) {
ob_start();
$sociable = (function_exists('sociable_html2') and function_exists(do_sociable())) ? do_sociable() : "";
$sociable = ob_get_contents();
ob_end_clean();
$postinfo = str_replace("%sociable%", $sociable, $postinfo);
}
// For the "Share This" plugin
if (strpos($postinfo_string, '%share-this%') !== FALSE) {
ob_start();
if (function_exists('sharethis_button')) {
sharethis_button();
$share_this = ob_get_contents();
} else {
$share_this = "";
}
ob_end_clean();
$postinfo = str_replace("%share-this%", $share_this, $postinfo);
}
// Images
if (strpos($postinfo_string, '<image(') !== FALSE) {
$postinfo = preg_replace_callback("|<image\\((.*?)\\)>|", "bfa_image_files", $postinfo);
}
/* The meta = ALL custom fields:values, formatted by Wordpress as
unordered list <ul><li>..</li><li>..</li></ul> */
if (strpos($postinfo_string, '%meta%') !== FALSE) {
ob_start();
the_meta();
$the_meta = ob_get_contents();
ob_end_clean();
// 3.4.3.: remove bfa_ata metas */
$the_meta = preg_replace("/<li>(.*)bfa_ata(.*)<\\/li>/i", "", $the_meta);
$postinfo = str_replace("%meta%", $the_meta, $postinfo);
}
// Single post meta values, not formatted
if (strpos($postinfo_string, '%meta(') !== FALSE) {
$postinfo = preg_replace_callback("|%meta\\('(.*?)'\\)%|", "bfa_meta_value", $postinfo);
}
// Since 3.6.7, parse widget areas
$postinfo = bfa_parse_widget_areas($postinfo);
return $postinfo;
}
示例9: insertPages_handleShortcode_insert
//.........这里部分代码省略.........
the_post();
$title_tag = $should_use_inline_wrapper ? 'span' : 'h1';
echo "<{$title_tag} class='insert-page-title'>";
the_title();
echo "</{$title_tag}>";
break;
case "link":
the_post();
?>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a><?php
break;
case "excerpt":
the_post();
?>
<h1><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h1><?php
if ($should_apply_the_content_filter) {
the_excerpt();
} else {
echo get_the_excerpt();
}
break;
case "excerpt-only":
the_post();
if ($should_apply_the_content_filter) {
the_excerpt();
} else {
echo get_the_excerpt();
}
break;
case "content":
the_post();
if ($should_apply_the_content_filter) {
the_content();
} else {
echo get_the_content();
}
break;
case "all":
the_post();
$title_tag = $should_use_inline_wrapper ? 'span' : 'h1';
echo "<{$title_tag} class='insert-page-title'>";
the_title();
echo "</{$title_tag}>";
if ($should_apply_the_content_filter) {
the_content();
} else {
echo get_the_content();
}
the_meta();
break;
default:
// display is either invalid, or contains a template file to use
$template = locate_template($display);
if (strlen($template) > 0) {
include $template;
// execute the template code
} else {
// Couldn't find template, so fall back to printing a link to the page.
the_post();
?>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a><?php
}
break;
}
$content = ob_get_contents();
// Save off output buffer
ob_end_clean();
// End output buffering
} else {
/**
* Filter the html that should be displayed if an inserted page was not found.
*
* @param string $content html to be displayed. Defaults to an empty string.
*/
$content = apply_filters('insert_pages_not_found_message', $content);
}
wp_reset_query();
$wrapper_tag = $should_use_inline_wrapper ? 'span' : 'div';
$content = "<{$wrapper_tag} data-post-id='{$page}' class='insert-page insert-page-{$page} {$class}'>{$content}</{$wrapper_tag}>";
return $content;
//return do_shortcode($content); // careful: watch for infinite loops with nested inserts
}
示例10: get_sidebar
?>
<div class="page-header">
<h1>currently no posts are availabe</h1>
</div>
<?php
}
?>
</div>
<?php
get_sidebar();
?>
</div>
</div>
<?php
echo the_meta();
echo wp_get_attachment_image(143);
global $post;
$thePostID = $post->ID;
echo $thePostID;
echo $post->post_title;
echo "khan";
$custom_field_value = get_post_custom_values('image1');
print_r($custom_field_value);
echo wp_get_attachment_image(implode($custom_field_value));
global $wpdb;
$get = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID=%h");
var_dump($get);
$url = wp_upload_dir();
var_dump($url);
get_footer();
示例11: process_shortcodes
function process_shortcodes($atts)
{
if (isset($atts['options']) && $atts['options']) {
$options = explode(',', $atts['options']);
unset($atts['options']);
} else {
$options = array('title', 'thumbnail', 'excerpt', 'readmore');
}
query_posts($atts);
while (have_posts()) {
the_post();
?>
<div>
<?php
foreach ($options as $option) {
switch ($option) {
case 'id':
?>
<div class="id"><?php
the_ID();
?>
</div><?php
break;
case 'title':
?>
<div class="title"><?php
the_title();
?>
</div><?php
break;
case 'thumbnail':
?>
<div class="thumbnail"><?php
the_thumbnail();
?>
</div><?php
break;
case 'excerpt':
?>
<div class="excerpt"><?php
the_excerpt();
?>
</div><?php
break;
case 'content':
?>
<div class="content"><?php
the_content();
?>
</div><?php
break;
case 'meta':
?>
<div class="meta"><?php
the_meta();
?>
</div><?php
break;
case 'author':
?>
<div class="author"><?php
the_author();
?>
</div><?php
break;
case 'readmore':
?>
<div class="readmore"><a href="<?php
the_permalink();
?>
">read more</a></div><?php
break;
case 'category':
?>
<div class="category"><?php
the_category();
?>
</div><?php
break;
case 'tags':
?>
<div class="tags"><?php
the_tags();
?>
</div><?php
break;
case 'terms':
?>
<div class="tags"><?php
the_terms();
?>
</div><?php
break;
}
}
?>
</div>
<?php
}
wp_reset_query();
//.........这里部分代码省略.........
示例12: formatting
/**
* Displays meta information for posts as a dump
* @param object $content The content of the current post
* @var $wp_query Global WordPress query variable
* @return string The post content with the meta information prepended as a dump
*/
function formatting($content)
{
global $wp_query;
return $content . the_meta();
}
示例13: the_post_thumbnail
</div>
<div class="clearfix"></div>
<div class="g10">
<?php
if ( has_post_thumbnail() ) {
// the current post has a thumbnail
} else {
// the current post lacks a thumbnail
}
?>
<?php the_post_thumbnail(); ?>
</div>
<div class="g2 pre2"><?php the_meta(); ?></div>
<div class="g2 pre2"><a class="blackbox" href="/"><p class="blackbox">Home sweet home</p></a></div>
</div><!--/post-->
</li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
<canvas id="canvas" width="1000" height="515"></canvas>
</div>
</body>
</html>
示例14: cust_field_text
function cust_field_text($column_name)
{
if ($column_name === 'cust_col') {
the_meta();
}
}