本文整理汇总了PHP中the_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP the_slug函数的具体用法?PHP the_slug怎么用?PHP the_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_slug函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ski_bg_class
function ski_bg_class()
{
if ($post->post_parent) {
$ancestors = get_post_ancestors($post->ID);
$root = count($ancestors) - 1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
function the_slug($id)
{
$post_data = get_post($id, ARRAY_A);
$slug = $post_data['post_name'];
return $slug;
}
switch (the_slug($parent)) {
case "home":
return "bg--home";
break;
case "resorts":
return "bg--resorts";
break;
case "community":
return "bg--community";
break;
case "deals":
return "bg--deals";
break;
case "blog":
return "bg--blog";
break;
default:
return "bg--default";
}
}
示例2: evolution_body_classes
function evolution_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
// Adds a class of hfeed to non-singular pages.
if (!is_singular()) {
$classes[] = 'hfeed';
}
$classes[] = 'page-' . the_slug();
return $classes;
}
示例3: new_nav_menu_items
function new_nav_menu_items($items)
{
$items = "";
$args = array("post_type" => "page", "order" => "ASC", "orderby" => "menu_order");
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
$items .= '<li><a href="#' . the_slug() . '">' . get_the_title() . '</a></li>';
}
} else {
echo "";
}
return $items;
}
示例4: get_the_slug
function get_the_slug( $post_id = -1 ) {
return the_slug( $post_id, false );
}
示例5: the_time
?>
</a></h3>
</div>
<div class="rw-two"><strong><?php
the_time('F d, Y');
?>
</strong><?php
$posts = get_field('article_authors');
if (isset($posts[0]->ID)) {
foreach ($posts as $p) {
?>
<a href="<?php
echo get_the_permalink(54);
?>
#<?php
the_slug(true, $p->ID);
?>
"><?php
echo get_the_title($p->ID);
?>
</a><?php
}
}
?>
</div>
</div>
<?php
$img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'team');
?>
<div class="pull-left photo" style="background-image:url(<?php
if (isset($img[0])) {
示例6: custom_field
<p class="text-center"><?php
echo custom_field('project_url', $post->ID);
?>
</p>
</div>
</div>
<div class="row">
<div class="col-lg-3 work-detail">
<?php
echo $post->post_content;
?>
<div class="row text-right" style="margin-top: 20px;">
<div class="col-lg-12">
<div class="link-to-project">
<a href="#" id="back" data-section="<?php
echo the_slug();
?>
" class="btn btn-new">Back</a>
<a href="http://nootsjeans.com" target="_blank" class="btn btn-new">Visit Site</a>
</div>
</div>
</div>
</div>
<div class="col-lg-9 text-center">
<img src="<?php
echo bloginfo('template_url');
?>
/assets/img/<?php
echo custom_field('project_showcase', $post->ID);
?>
示例7: the_slug
the_slug();
?>
" title="<?php
the_title_attribute();
?>
">
<?php
the_post_thumbnail('small-portrait');
?>
<?php
the_title();
?>
</a>
<div id="<?php
the_slug();
?>
" class="reveal-modal" data-reveal aria-labelledby="<?php
the_title();
?>
" aria-hidden="true" role="dialog">
<div class="row">
<div class="small-12 medium-3 columns">
<?php
the_post_thumbnail('small-portrait');
?>
</div>
<div class="small-12 medium-9 columns">
<h1 class="entry-title"><?php
示例8: the_slug
$title = $vid['panel_video_title'];
$desc = $vid['panel_video_description'];
if ($title) {
echo '<h4>' . $title . '</h4>';
}
echo '<div class="embed-container">' . $vid['panel_video_link'] . '</div>';
if ($desc) {
echo '<div class="well well-sm video-caption">' . $desc . '</div>';
}
}
echo '</div>';
echo '<div class="col-sm-8 col-sm-pull-4 panel-post">';
} else {
echo '<div class="col-sm-12 panel-post">';
}
echo '<a id="' . the_slug() . '"></a>';
echo '<h2>' . get_the_title() . '</h2>';
if ($day) {
// Check for legacy screening times
if (preg_match('/\\s/', $day)) {
// Check for white space - New schedule builder will print formatted date/time
echo '<p>' . $day . ' approx. ' . $start . '</p>';
} else {
// Old schedule builder prints unix string
echo '<p>' . date("F jS, Y", strtotime($day)) . ' approx. ' . date("g:i a", $start) . '</p>';
}
}
the_content();
echo '</div>';
$i++;
}
示例9: get_header
<?php
get_header();
?>
<?php
while (have_posts()) {
the_post();
$slug = the_slug(false);
?>
<div class="banner white hidden-xs">
<img src="<?php
echo home_url();
?>
/assets/images/photos/<?php
echo $slug;
?>
.jpg"/>
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1 textRight">
<div class="arrow"></div>
<a href="<?php
echo home_url();
?>
">
<img class="logo" src="<?php
echo home_url();
?>
/assets/images/logo2.png">
</a>
</div>
示例10: get_page_link
">
<button type="button" class="btn btn-default btn-lg">Enroll</button>
</a>
<a href="<?php
echo get_page_link(get_page_by_title('policies')->ID);
?>
">
<button type="button" class="btn btn-default btn-lg">Policies</button>
</a>
</div>
</article>
<div class="container col-md-9">
<div class="row">
<h2>Teachers</h2>
<?php
$thumbquery = new WP_Query(array('meta_value' => the_slug(), 'post_type' => 'teachers'));
while ($thumbquery->have_posts()) {
$thumbquery->the_post();
?>
<div class="col-md-3">
<a href="<?php
the_permalink;
?>
">
<?php
the_post_thumbnail('medium');
?>
</a>
示例11: the_title
<div class="wholemilk">
<h3>Related News Posts</h3>
<p>Any recent news entries about <?php
the_title();
?>
will appear below. You can also subscribe to the <a href="http://www.splost.info/?tag=<?php
echo the_slug();
?>
&feed=rss2">RSS Feed</a> for updates on <?php
the_title();
?>
, or if you'd like, this <a href="http://www.splost.info/feed=rss2">RSS Feed</a> for all SPLOST updates.
<div id="relevantPosts"><!-- search through posts for matching tag -->
<?php
// The Query
$page_title = the_slug();
$args = array('numberposts' => 5, 'order' => 'DESC', 'orderby' => 'post_date', 'tag' => $page_title);
query_posts($args);
// The Loop
while (have_posts()) {
the_post();
echo '<h6>';
the_date();
?>
</h6><h5>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
示例12: setup_postdata
if ($type === 'panel') {
$p_obj = $block['block_panel'];
$post = $p_obj;
if ($style) {
echo '<dd class="' . $style . '">';
} else {
echo '<dd>';
}
if ($post) {
setup_postdata($post);
$panel_id = get_the_ID();
echo '<span class="block-time">';
echo $start . ' ' . $dash . ' ' . $end;
echo '</span>';
echo '<span class="block-info">';
echo '<a href="/panels/#' . the_slug() . '"><b>' . get_the_title() . '</b></a>';
echo '</span>';
wp_reset_postdata();
}
var_dump($panel_id);
echo '</dd>';
// Save Schedule info for panels page
$panel_day_key = "field_53e914a201dc8";
update_field($panel_day_key, $festDay, $panel_id);
$panel_start_key = "field_53e9150b01dc9";
update_field($panel_start_key, $start, $panel_id);
}
}
echo '<dl>';
echo '</div>';
$i++;