本文整理汇总了PHP中the_title函数的典型用法代码示例。如果您正苦于以下问题:PHP the_title函数的具体用法?PHP the_title怎么用?PHP the_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charity_vc_our_mission
function charity_vc_our_mission($atts, $content = null)
{
extract(shortcode_atts(array('our_mission' => ''), $atts));
$page_id = get_page_by_title($our_mission);
$missionQuery = new WP_Query(array("page_id" => $page_id->ID));
if ($missionQuery->have_posts()) {
$missionQuery->the_post();
$url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
?>
<!-- Save Lives Section Start Here-->
<section class="save-lives text-center parallax" style="background-image: url('<?php
echo esc_url($url[0]);
?>
')">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<header class="page-header">
<h2><?php
the_title();
?>
</h2>
<?php
the_content();
?>
</header>
</div>
</div>
</div>
</section>
<!-- Save Lives Section Start Here-->
<?php
}
wp_reset_postdata();
}
示例2: bootstrap_breadcrumbs
/**
* Add breadcrumbs functionality to your WordPress theme
*
* Once you have included the function in your functions.php file
* you can then place the following anywhere in your theme templates
* if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
*
* credit to: c.bavota - http://bavotasan.com (thanks for the code start)
*/
function bootstrap_breadcrumbs()
{
echo '<ol class="breadcrumb">';
echo '<li><a href="' . home_url('/') . '">Home</a></li>';
// are we at "blog home"?
if (is_home()) {
echo '<li><a href="#">Blogs</a></li>';
}
// where else do we want breadcrumbs
if (!is_page_template('pt-home.php') && !is_home()) {
// check if we're in a commerce plugin
if (function_exists('is_woocommerce') && is_woocommerce()) {
echo '<li><a href="/publications/order/">Shop</a></li>';
$product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
}
// breadcrumb wordpress structures
if (is_category() || is_single() || is_single('aof')) {
if (get_the_category()) {
$category = get_the_category();
echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
}
if (is_single()) {
echo '<li class="active">';
the_title();
echo '</li>';
}
} elseif (is_page()) {
echo '<li class="active">';
the_title();
echo '</li>';
}
}
echo '</ol>';
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$countt = apply_filters('widget_guanzhu_sina', empty($instance['countt']) ? __('nothing') : $instance['countt']);
//小工具前台标题
echo $before_widget;
echo '<i class="iconfont iconfont-siadebar"></i>
<h3 class="widget-title">
热门文章
</h3>
<div class="widget-main widget-main-hot">
<ul>';
if (intval($countt) <= 10) {
$popular = new WP_Query('orderby=comment_count&posts_per_page=' . $countt);
$count_di = 1;
while ($popular->have_posts()) {
$popular->the_post();
echo '<li><span>' . $count_di . '</span>' . '<a href="';
the_permalink();
echo '">';
the_title();
echo '</a></li>';
$count_di++;
}
}
echo '</ul>';
echo '</div>';
echo $after_widget;
}
示例4: widget
public function widget($args, $instance)
{
?>
<?php
echo $args['before_widget'];
?>
<?php
echo $args['before_title'];
echo $instance['title'];
echo $args['after_title'];
?>
<div class="list-group">
<?php
$arg = array('posts_per_page' => 5, 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC');
$newposts = new WP_Query($arg);
while ($newposts->have_posts()) {
$newposts->the_post();
?>
<a class="list-group-item" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
<?php
}
wp_reset_postdata();
?>
</div>
<?php
echo $args['after_widget'];
?>
<?php
}
示例5: featureText
function featureText()
{
if (is_front_page()) {
the_field('feature_text');
} elseif (is_home() || is_single()) {
_e('Rock Theme Official Blog');
} elseif (is_archive()) {
_e('Rock Theme Official Blog');
_e('<br>');
single_term_title('Browsing: ');
if (is_month()) {
$monthNum = get_query_var('monthnum');
$month = date('F', mktime(0, 0, 0, $monthNum));
$year = get_query_var('year');
echo 'Posts from ' . $month . ' ' . $year;
}
} elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) {
bloginfo('name');
_e('<br>');
the_title();
} elseif (is_404()) {
_e('Whoops, were a little lost.');
} elseif (is_search()) {
_e('Rock Theme Official Blog');
_e('<br>');
printf('Search results for: %s', get_search_query());
}
}
示例6: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="recent-works-items clearfix">
<?php
$args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
$portfolio = new WP_Query($args);
if ($portfolio->have_posts()) {
?>
<?php
while ($portfolio->have_posts()) {
$portfolio->the_post();
?>
<?php
if (has_post_thumbnail()) {
?>
<?php
$link_target = "";
$url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
if (!empty($url_check)) {
$new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
$link_target = ' target="_blank"';
}
} else {
$new_permalink = get_permalink();
}
?>
<a href="<?php
echo $new_permalink;
?>
"<?php
echo $link_target;
?>
title="<?php
the_title();
?>
">
<?php
the_post_thumbnail('recent-works-thumbnail');
?>
</a>
<?php
}
}
}
wp_reset_query();
?>
</div>
<?php
echo $after_widget;
}
示例7: magee_breadcrumb
function magee_breadcrumb($options = "")
{
$this->options = array('before' => '<span class="arrow"> ', 'after' => ' </span>', 'delimiter' => ' / ');
if (is_array($options)) {
$this->options = array_merge($this->options, $options);
}
$markup = $this->options['before'] . $this->options['delimiter'] . $this->options['after'];
global $post;
echo '<p class="magee-breadcrumb"><a href="' . get_bloginfo('url') . '">';
_e("Home", 'magee');
echo "</a>";
if (!is_front_page()) {
echo $markup;
}
$output = $this->magee_simple_breadcrumb_case($post);
echo "<span class='current_crumb'>";
if (is_page() || is_single()) {
if (is_front_page()) {
echo $markup;
the_title();
} else {
the_title();
}
} else {
echo $output;
}
echo " </span></p>";
}
示例8: form
function form($instance)
{
?>
<p><label for="<?php
echo $this->get_field_id('ewic_shortcode');
?>
">Select your Slider name and hit save button.<br />
<select id="<?php
echo $this->get_field_id('ewic_shortcode');
?>
" name="<?php
echo $this->get_field_name('ewic_shortcode');
?>
" >
<?php
global $post;
$args = array('post_type' => 'easyimageslider', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'publish');
$myposts = get_posts($args);
foreach ($myposts as $post) {
setup_postdata($post);
echo '<option value=' . $post->ID . '' . selected($instance["ewic_shortcode"], $post->ID) . '>' . esc_html(esc_js(the_title(NULL, NULL, FALSE))) . '</option>';
}
?>
</select></label></p>
<?php
}
示例9: show_faq
function show_faq($atts)
{
ob_start();
$secondary_query = new WP_Query(array('post_type' => 'questions', 'posts_per_page' => $atts[limit], 'tax_query' => array(array('taxonomy' => 'faq', 'field' => 'slug', 'terms' => $atts[category], 'operator' => 'IN'))));
if ($secondary_query->have_posts()) {
while ($secondary_query->have_posts()) {
$secondary_query->the_post();
echo '
<div class="row">
<div class="col-lg-8 col-lg-offset-2 centered">
';
the_post();
the_post_thumbnail('thumbnail');
the_title('<h1>', '</h1>');
the_content();
echo '
</div>
</div>
';
}
// end while
}
// end if
wp_reset_postdata();
return ob_get_clean();
}
示例10: mdwpbp_related_posts
function mdwpbp_related_posts()
{
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
foreach ($tags as $tag) {
$tag_arr = $tag->slug . ',';
}
$args = array('tag' => $tag_arr, 'numberposts' => 5, 'post__not_in' => array($post->ID));
$related_posts = get_posts($args);
if ($related_posts) {
echo '<p class="related-posts-header">Related Posts</p><ul id="mdwpbp-related-posts">';
foreach ($related_posts as $post) {
setup_postdata($post);
echo '<li class="related-post"><a href="';
the_permalink();
echo '">';
the_title();
echo '</a></li>';
}
echo '</ul>';
}
}
// if ($tags)
wp_reset_postdata();
}
示例11: widget
function widget($args, $instance)
{
// prints the widget
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$category = empty($instance['category']) ? '' : apply_filters('widget_category', $instance['category']);
$post_type = empty($instance['post_type']) ? 'post' : apply_filters('widget_post_type', $instance['post_type']);
$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
?>
<div class="featured_video">
<?php
if ($title) {
?>
<h3 class="clearfix"> <?php
echo $title;
?>
</h3><?php
}
?>
<?php
global $post;
$args = '';
if ($category) {
$args .= '&category=' . $category;
}
$latest_menus = get_posts('numberposts=' . $post_number . $args . '&post_type=' . $post_type);
foreach ($latest_menus as $post) {
setup_postdata($post);
if (get_post_meta($post->ID, 'video', true) || get_post_meta($post->ID, 'Video', true) || get_post_meta($post->ID, 'VIDEO', true)) {
if (get_post_meta($post->ID, 'video', true)) {
$video = get_post_meta($post->ID, 'video', true);
} elseif (get_post_meta($post->ID, 'Video', true)) {
$video = get_post_meta($post->ID, 'Video', true);
} elseif (get_post_meta($post->ID, 'VIDEO', true)) {
$video = get_post_meta($post->ID, 'VIDEO', true);
}
?>
<div class="video">
<?php
echo $video;
?>
<h4><a class="widget-title" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h4>
</div>
<?php
}
?>
<?php
}
?>
</div>
<?php
echo $after_widget;
}
示例12: post_excerpts_here
function post_excerpts_here()
{
//posts with date, author, time, content excerpts, and title..
if (have_posts()) {
while (have_posts()) {
echo '<div class="excerpt-div">';
the_post();
echo '<h2 class="post-title"><a href="';
the_permalink();
echo '" title="';
the_title();
echo '">';
the_title();
echo '</a></h2>';
echo '<h4 class="post-info">';
echo 'Created on ';
the_date();
echo ' at ';
the_time();
echo ' by ';
the_author_meta(first_name);
echo '.</h4>';
echo '<p class="post-excerpt">';
the_excerpt();
echo '</p>';
echo '</div>';
}
// end while
}
// end if
}
示例13: widget
function widget($args, $instance)
{
extract($args);
$ci_post_id = $instance['postid'];
$post_type_name = $instance['post_type_name'];
if (empty($ci_post_id) or empty($post_type_name)) {
return;
}
$q = new WP_Query(array('post_type' => $post_type_name, 'p' => $ci_post_id));
echo $before_widget;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
while ($q->have_posts()) {
$q->the_post();
global $post;
if (get_post_type() == 'testimonial') {
?>
<blockquote class="testimonial">
<i class="fa fa-quote-left"></i>
<?php
the_content();
?>
<cite><?php
the_title();
?>
</cite>
</blockquote>
<?php
} else {
ci_get_template_part('loop', 'item', array('title' => $title));
}
}
wp_reset_postdata();
echo $after_widget;
}
示例14: mvm_display_singer_list
function mvm_display_singer_list()
{
$args = array('post_type' => 'singer', 'posts_per_page' => -1, 'post_status' => 'published');
$singers = new WP_Query($args);
if ($singers->have_posts()) {
?>
<ul class="mvm_singers_list">
<?php
while ($singers->have_posts()) {
$singers->the_post();
?>
<li id="singer-<?php
the_id();
?>
" class="mvm_singer" singer-id="<?php
the_id();
?>
">
<?php
the_title();
?>
</li>
<?php
}
wp_reset_postdata();
?>
</ul>
<?php
}
}
示例15: do_x_post_password_cb
function do_x_post_password_cb()
{
//snag from wp-login.php:386-393
require_once ABSPATH . 'wp-includes/class-phpass.php';
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
// 10 days
setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['pass'])), time() + 864000, COOKIEPATH);
//fake it so it's available in the loop below
$_COOKIE['wp-postpass_' . COOKIEHASH] = $wp_hasher->HashPassword(stripslashes($_POST['pass']));
$q = new WP_Query("p={$_POST['pid']}");
if ($q->have_posts()) {
while ($q->have_posts()) {
$q->the_post();
// verifies password hash
if (post_password_required()) {
wp_send_json_error('Invalid password');
}
// get post title
ob_start();
the_title(sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a>');
$title = ob_get_clean();
// get post content
ob_start();
the_content();
$content = ob_get_clean();
}
}
wp_reset_postdata();
$return = array('title' => $title, 'content' => $content);
wp_send_json_success($return);
}