Exemplo n.º 1
0
<?php

get_header();
?>

	<div id="content">
		<div class="container">
			<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        $options = get_metabox_options("page_options");
        $has_sidebar = !empty($options['has_sidebar']) && $options['has_sidebar'] === 'yes' && !empty($options['sidebar']) ? 'has-sidebar' : false;
        $sidebar_position = !empty($options['sidebar_position']) ? $options['sidebar_position'] : 'right';
        ?>
			<div id="breadcrumbs"><?php 
        the_breadcrumb();
        ?>
</div>
			<article <?php 
        post_class($has_sidebar . ' sidebar-' . $sidebar_position);
        ?>
>
				<h1 class="post-title"><?php 
        the_title();
        ?>
</h1>
				<?php 
        if ($has_sidebar) {
            ?>
				<div class="row">
Exemplo n.º 2
0
<?php

/*
Template name: Redirect Page
*/
$info = get_metabox_options('tpl-redirect-page');
$redirect = get_bloginfo('url');
if (!empty($info['redirect_to'])) {
    if ($info['redirect_to'] === 'subpage') {
        $subpages = get_pages(array('child_of' => $post->ID, 'parent' => $post->ID, 'sort_column' => 'menu_order', 'sort_order' => 'ASC'));
        if ($subpages) {
            $redirect = get_permalink($subpages[0]->ID);
        }
    } else {
        if ($info['id']) {
            $redirect = get_permalink($info['id']);
        }
    }
}
wp_redirect($redirect);
die;
// metabox
/* ==== Template: Redirect Page ============================================= */
$Forms->remove_supports(array('template' => 'tpl-redirect-page'), array('editor', 'revisions'));
$Forms->add_template_metabox('tpl-redirect-page', array('fields' => array('redirect_to' => array('type' => 'radio', 'inline' => true, 'default' => 'id', 'options' => array('id' => 'Any Post', 'subpage' => 'First Subpage')), 'id' => array('title' => 'Post to redirect to', 'type' => 'post', 'toggle' => array('redirect_to' => 'id')))));
Exemplo n.º 3
0
<?php

// meant to be used inside the loop
if (!isset($post)) {
    global $post;
}
$info = get_metabox_options('page-info');
// title
if (empty($info['hide_title'])) {
    $title = !empty($info['title']) ? $info['title'] : $post->post_title;
} else {
    $title = false;
}
// content
if (!isset($content)) {
    $content = apply_filters('the_content', $post->post_content);
}
$has_sidebar = !empty($info['has_sidebar']);
if ($has_sidebar && empty($sidebar)) {
    $sidebar = $info['sidebar'];
}
$classes = array('page-content');
if ($has_sidebar) {
    $classes[] = 'has-sidebar';
}
if (!empty($info['remove_bottom_padding'])) {
    $classes[] = 'no-bottom-padding';
}
?>
<div class="<?php 
echo implode(' ', $classes);