本文整理汇总了PHP中the_title_attribute函数的典型用法代码示例。如果您正苦于以下问题:PHP the_title_attribute函数的具体用法?PHP the_title_attribute怎么用?PHP the_title_attribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_title_attribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: latte_post_format_tools_aside_infinity
function latte_post_format_tools_aside_infinity($content)
{
if (has_post_format('aside') && !is_singular()) {
$content .= ' <a class="permalink" href="' . get_permalink() . '" title="' . the_title_attribute(array('echo' => false)) . '">∞</a>';
}
return $content;
}
示例2: widget
/**
* Display widget content.
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, $this->defaults);
$featured_page = new WP_Query(array('page_id' => $instance['page_id']));
echo $before_widget . '<div class="feature-page">';
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
if ($featured_page->have_posts()) {
while ($featured_page->have_posts()) {
$featured_page->the_post();
echo '<div class="' . implode(' ', get_post_class()) . '">';
if (!empty($instance['show_title'])) {
printf('<h4 class="entry-title"><a href="%s" title="%s">%s</a></h4>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
}
//Show image
if (!empty($instance['show_image'])) {
printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
}
if (!empty($instance['show_content'])) {
if (empty($instance['content_limit'])) {
the_content($instance['more_text']);
} else {
the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
}
}
echo '</div><!--end post_class()-->' . "\n\n";
}
}
echo '</div>' . $after_widget;
wp_reset_query();
}
示例3: woo_widget_tabs_latest
function woo_widget_tabs_latest($posts = 5, $size = 45)
{
global $post;
$latest = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'numberposts' => $posts));
foreach ($latest as $post) {
setup_postdata($post);
?>
<li>
<?php
if ($size != 0) {
woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true');
}
?>
<a title="<?php
the_title_attribute();
?>
" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
<span class="meta"><?php
the_time(get_option('date_format'));
?>
</span>
<div class="fix"></div>
</li>
<?php
}
wp_reset_postdata();
}
示例4: mashsb_load_scripts
/**
* Load Scripts
*
* Enqueues the required scripts.
*
* @since 1.0
* @global $mashsb_options
* @global $post
* @return void
* @param string $hook Page hook
*/
function mashsb_load_scripts($hook)
{
global $wp;
if (!apply_filters('mashsb_load_scripts', mashsbGetActiveStatus(), $hook)) {
mashdebug()->info("mashsb_load_script not active");
return;
}
global $mashsb_options, $post;
$url = get_permalink($post->ID);
$title = urlencode(html_entity_decode(the_title_attribute('echo=0'), ENT_COMPAT, 'UTF-8'));
$title = str_replace('#', '%23', $title);
$titleclean = esc_html($title);
$image = mashsb_get_image($post->ID);
$desc = mashsb_get_excerpt_by_id($post->ID);
/* Load hashshags */
$hashtag = !empty($mashsb_options['mashsharer_hashtag']) ? $mashsb_options['mashsharer_hashtag'] : '';
$js_dir = MASHSB_PLUGIN_URL . 'assets/js/';
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = mashsbIsDebugMode() ? '' : '.min';
//$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
isset($mashsb_options['load_scripts_footer']) ? $in_footer = true : ($in_footer = false);
wp_enqueue_script('mashsb', $js_dir . 'mashsb' . $suffix . '.js', array('jquery'), MASHSB_VERSION, $in_footer);
!isset($mashsb_options['disable_sharecount']) ? $shareresult = getSharedcount($url) : ($shareresult = 0);
wp_localize_script('mashsb', 'mashsb', array('shares' => $shareresult, 'round_shares' => isset($mashsb_options['mashsharer_round']), 'animate_shares' => isset($mashsb_options['animate_shares']) && is_singular() ? 1 : 0, 'share_url' => $url, 'title' => $titleclean, 'image' => $image, 'desc' => $desc, 'hashtag' => $hashtag, 'subscribe' => !empty($mashsb_options['subscribe_behavior']) && $mashsb_options['subscribe_behavior'] === 'content' ? 'content' : 'link', 'subscribe_url' => isset($mashsb_options['subscribe_link']) ? $mashsb_options['subscribe_link'] : '', 'activestatus' => mashsbGetActiveStatus(), 'singular' => is_singular() ? 1 : 0, 'twitter_popup' => isset($mashsb_options['twitter_popup']) ? 0 : 1));
}
示例5: get_seo_plugin_datas
/**
* @param $type
*
* @return string|void
*/
public function get_seo_plugin_datas($type)
{
$aioseop_title = get_post_meta($this->post_ID, '_aioseop_title', true);
$aioseop_description = get_post_meta($this->post_ID, '_aioseop_description', true);
$yoast_wpseo_title = get_post_meta($this->post_ID, '_yoast_wpseo_title', true);
$yoast_wpseo_description = get_post_meta($this->post_ID, '_yoast_wpseo_metadesc', true);
$title = get_the_title($this->post_ID);
$desc = Utilities::get_excerpt_by_id($this->post_ID);
if (class_exists('WPSEO_Frontend')) {
$title = !empty($yoast_wpseo_title) ? htmlspecialchars(stripcslashes($yoast_wpseo_title)) : get_the_title($this->post_ID);
$desc = !empty($yoast_wpseo_description) ? htmlspecialchars(stripcslashes($yoast_wpseo_description)) : Utilities::get_excerpt_by_id($this->post_ID);
} elseif (class_exists('All_in_One_SEO_Pack')) {
$title = !empty($aioseop_title) ? htmlspecialchars(stripcslashes($aioseop_title)) : the_title_attribute(array('echo' => false));
$desc = !empty($aioseop_description) ? htmlspecialchars(stripcslashes($aioseop_description)) : Utilities::get_excerpt_by_id($this->post_ID);
}
switch ($type) {
case 'title':
return $title;
break;
case 'desc':
return $desc;
break;
default:
return $title;
}
}
示例6: load_5speed_archive
function load_5speed_archive()
{
echo "<h3 class=\"list-title\">My list of reasons why I drive a manual transmission car:</h3>";
echo "<div class=\"5speed\">";
while (have_posts()) {
the_post();
?>
<li>
<h3 style="margin-bottom:0px;"># <a href="<?php
the_permalink();
?>
" rel="bookmark" title="Reason <?php
the_title_attribute();
?>
"><?php
the_title();
?>
</a></h3>
<?php
the_content();
?>
</li>
<?php
}
echo "</div>";
}
示例7: tb_ad_featured_thumbnail
function tb_ad_featured_thumbnail()
{
global $post;
// go see if any images are associated with the ad
$image_id = cp_get_featured_image_id($post->ID);
// set the class based on if the hover preview option is set to "yes"
if (get_option('cp_ad_image_preview') == 'yes') {
$prevclass = 'preview';
} else {
$prevclass = 'nopreview';
}
if ($image_id > 0) {
// get 50x50 v3.0.5+ image size
$adthumbarray = wp_get_attachment_image($image_id, 'ad-small');
// grab the large image for onhover preview
$adlargearray = wp_get_attachment_image_src($image_id, 'large');
$img_large_url_raw = $adlargearray[0];
// must be a v3.0.5+ created ad
if ($adthumbarray) {
echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumbarray . '</a>';
// maybe a v3.0 legacy ad
} else {
$adthumblegarray = wp_get_attachment_image_src($image_id, 'ad-small');
$img_thumbleg_url_raw = $adthumblegarray[0];
echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumblegarray . '</a>';
}
// no image so return the placeholder thumbnail
} else {
echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"><img class="attachment-sidebar-thumbnail" alt="" title="" src="' . get_stylesheet_directory_uri() . '/images/no-thumb-100.jpg" /></a>';
}
}
示例8: twentyten_posted_in
function twentyten_posted_in()
{
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list('', ', ');
$temp_tag_array = explode(', ', $tag_list);
$buf_tag_list = array();
foreach ($temp_tag_array as $temp_tag) {
if (strpos($temp_tag, "html") > 0) {
$buf_tag_list[] = '<div class="html">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "css") > 0) {
$buf_tag_list[] = '<div class="css">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "jquery") > 0) {
$buf_tag_list[] = '<div class="jquery">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "Javascript") > 0) {
$buf_tag_list[] = '<div class="Javascript">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "wordpress") > 0) {
$buf_tag_list[] = '<div class="wordpress">' . $temp_tag . '</div>';
} else {
$buf_tag_list[] = $temp_tag;
}
}
$tag_list = implode(', ', $buf_tag_list);
if ($tag_list) {
$posted_in = __('This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
} elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
$posted_in = __('This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
} else {
$posted_in = __('Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
}
// Prints the string, replacing the placeholders.
printf($posted_in, get_the_category_list(', '), $tag_list, get_permalink(), the_title_attribute('echo=0'));
}
示例9: featured_image
public static function featured_image($post_ID, $size = 'full', $class_array = [], $include_caption = false)
{
$class_array[] = 'img-responsive';
// For Bootstrap responsive images
$class = implode(' ', $class_array);
// Ensure that all images are responsive
if (has_post_thumbnail($post_ID)) {
/* get the title attribute of the post or page
* and apply it to the alt tag of the image if the alt tag is empty
*/
$attachment_id = get_post_thumbnail_id($post_ID);
// if no alt attribute is filled out then echo "Featured Image of article: Article Name"
if ('' === get_post_meta($attachment_id, '_wp_attachment_image_alt', true)) {
$alt = the_title_attribute(array('before' => __('Featured image of article: ', 'castleview'), 'echo' => false));
} else {
$alt = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
}
// Get the title attribute for the featured image
$title = get_the_title($attachment_id);
// Get the Image Caption
$caption = get_post($attachment_id)->post_excerpt;
$default_attr = array('class' => $class, 'alt' => $alt, 'title' => $title);
if (false === $include_caption) {
return get_the_post_thumbnail($post_ID, $size, $default_attr);
}
if (true === $include_caption) {
return ['image' => get_the_post_thumbnail($post_ID, $size, $default_attr), 'caption' => $caption];
}
}
}
示例10: cw_magazine_the_attached_image
/**
* Prints the attached image with a link to the next attached image.
*/
function cw_magazine_the_attached_image()
{
$post = get_post();
$attachment_size = apply_filters('underscore_attachment_size', array(1200, 1200));
$next_attachment_url = wp_get_attachment_url();
/**
* Grab the IDs of all the image attachments in a gallery so we can get the
* URL of the next adjacent image in a gallery, or the first image (if
* we're looking at the last image in a gallery), or, in a gallery of one,
* just the link to that image file.
*/
$attachment_ids = get_posts(array('post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
// If there is more than 1 attachment in a gallery...
if (count($attachment_ids) > 1) {
foreach ($attachment_ids as $attachment_id) {
if ($attachment_id == $post->ID) {
$next_id = current($attachment_ids);
break;
}
}
// get the URL of the next image attachment...
if ($next_id) {
$next_attachment_url = get_attachment_link($next_id);
} else {
$next_attachment_url = get_attachment_link(array_shift($attachment_ids));
}
}
printf('<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>', esc_url($next_attachment_url), the_title_attribute(array('echo' => false)), wp_get_attachment_image($post->ID, $attachment_size));
}
示例11: printWidget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function printWidget($args, $instance)
{
// Get URL
global $wp;
$url = add_query_arg($wp->query_string, '', home_url($wp->request));
$title = the_title_attribute(['echo' => 0]) . ' from ' . get_bloginfo('name');
// Get meta information
$desc = \Proud\Core\wp_trim_excerpt('', false, true);
?>
<!--<div class="dropdown share">-->
<a href="#" id="share-dropdown" data-toggle="dropdown"><i class="fa fa-fw fa-share-alt"></i>Share <!--<span class="caret"></span>--></a>
<ul class="dropdown-menu" aria-labelledby="share-dropdown">
<li><a href="https://www.facebook.com/sharer/sharer.php" target="_blank"><i class="fa fa-facebook-square fa-fw"></i> Facebook</a></li>
<li><a href="http://twitter.com/share"><i class="fa fa-twitter-square fa-fw"></i> Twitter</a></li>
<li><a href="mailto:?subject=<?php
print urlencode($title);
?>
&body=Read more: <?php
print urlencode($url);
?>
"><i class="fa fa-envelope fa-fw"></i> Email</a>
</ul>
<!--</div>-->
<?php
}
示例12: reactor_do_standard_header_titles
/**
* Post header
* in format-standard
*
* @since 1.0.0
*/
function reactor_do_standard_header_titles()
{
if (!is_single() && get_post_meta(get_the_ID(), '_amaga_titol', true) == "on") {
edit_post_link(__('Edit'), '<div class="edit-link"><span>', '</span></div>');
return;
}
if (is_single()) {
?>
<h1 class="entry-title"><?php
the_title();
?>
</h1>
<?php
} else {
?>
<h2 class="entry-title"><a href="<?php
the_permalink();
?>
" title="<?php
echo esc_attr(sprintf(__('%s', 'reactor'), the_title_attribute('echo=0')));
?>
" rel="bookmark"><?php
the_title();
?>
</a></h2>
<?php
}
edit_post_link(__('Edit'), '<div class="edit-link"><span>', '</span></div>');
}
示例13: depo_about_widget
function depo_about_widget()
{
?>
<li id="depo_about">
<?php
query_posts('pagename=about');
?>
<?php
while (have_posts()) {
the_post();
?>
<h2><a href="<?php
the_permalink();
?>
" rel="bookmark" title="<?php
printf(__('Permanent Link to %s', 'depo-masthead'), the_title_attribute('echo=0'));
?>
"><?php
the_title();
?>
</a></h2>
<div class="entry">
<?php
continue_reading_excerpt();
?>
</div>
<?php
}
?>
</li>
<?php
}
示例14: post_format_image_featured
function post_format_image_featured()
{
if (has_post_format('image') && has_post_thumbnail() && is_singular('post')) {
$img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'post-image')));
printf('<a href="%s" id="featured-post-image" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
}
}
示例15: ipin_opengraph
function ipin_opengraph()
{
if (is_single()) {
global $post;
setup_postdata($post);
$output = '<meta property="og:type" content="article" />' . "\n";
$output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', the_title_attribute('echo=0')) . '" />' . "\n";
$output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
$output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
if (has_post_thumbnail()) {
$imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
$output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
}
echo $output;
}
if (is_tax('board')) {
global $post, $wp_query;
setup_postdata($post);
$output = '<meta property="og:type" content="article" />' . "\n";
$output .= '<meta property="og:title" content="' . $wp_query->queried_object->name . '" />' . "\n";
$output .= '<meta property="og:url" content="' . home_url('/board/') . $wp_query->queried_object->term_id . '/" />' . "\n";
$output .= '<meta property="og:description" content="" />' . "\n";
if (has_post_thumbnail()) {
$imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
$output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
}
echo $output;
}
}