Пример #1
0
<?php

/**
 * default content output
 * page
 * single
 * attachment
 *
 * @package Bedstone
 */
// get article title (only displayed if conditions are met below)
$article_title = bedstone_get_the_alternate_title();
?>

<article <?php 
post_class();
?>
 id="post-<?php 
the_ID();
?>
">

    <?php 
if ('post' == get_post_type() || $article_title != get_the_title()) {
    ?>
        <header class="article-header">
            <h2><?php 
    echo $article_title;
    ?>
</h2>
            <?php 
Пример #2
0
/**
 * Display an alternate title
 *
 * These are for seo when we need one "menu" title and another via title_alternate custom field
 *
 * @param string for output before title
 * @param string for output after title
 * @param bool will echo on true
 *
 * @return string title in some cases
 */
function bedstone_the_alternate_title($before = '', $after = '', $echo = true)
{
    // based on the_title() in /wp-includes/post-template.php
    $title = bedstone_get_the_alternate_title();
    if (0 == strlen($title)) {
        return;
    }
    $title = $before . $title . $after;
    if ($echo) {
        echo $title;
    } else {
        return $title;
    }
}