Пример #1
0
function get_theme_default_options()
{
    return array('pagina_help' => site_url('sobre'), 'pagina_sugerir' => site_url('sugerir-uma-meta'), 'data_encerramento' => '2011-10-01', 'object_labels' => ObjectPostType::get_default_labels(), 'taxonomy_labels' => ObjectPostType::get_taxonomy_default_labels(), 'taxonomy_url' => 'tipo', 'object_url' => 'objeto', 'allow_suggested' => false, 'suggested_labels' => array('title' => 'Adicionar novo objeto', 'description' => 'Utilize essa página para criar um novo objeto.', 'success' => 'Objeto criado com sucesso!', 'list' => 'Objetos sugeridos pelos usuários'), 'enable_taxonomy' => false, 'list_type' => 'normal', 'object_list_intro' => '', 'list_order' => 'desc', 'list_order_by' => 'creation_date', 'use_evaluation' => false, 'evaluation_show_on_list' => false, 'evaluation_public_results' => false, 'evaluate_button' => 'Votar!', 'evaluation_labels' => array('label_1' => __('Concordo', 'consulta'), 'label_2' => __('Não concordo', 'consulta'), 'label_3' => '', 'label_4' => '', 'label_5' => ''), 'evaluation_text' => __('Você concorda com esta proposta?', 'consulta'), 'evaluation_type' => 'percentage', 'pagina_participe' => '');
}
Пример #2
0
     * Chamado sempre que um post é salvo
     * 
     * @return null
     */
    static function savePost($postId)
    {
        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
            return;
        }
        if (isset($_POST['post_type']) && $_POST['post_type'] != 'object' || !is_admin()) {
            return;
        }
        update_post_meta($postId, '_user_created', false);
    }
}
ObjectPostType::init();
add_action('restrict_manage_posts', 'consulta_restrict_listings');
/**
 * Na listagem de objetos no admin adiciona uma opção para exibir
 * somente os objetos criados pelos admins ou então os objetos criados
 * pelos demais usuários.
 * 
 * @return null
 */
function consulta_restrict_listings()
{
    global $typenow;
    global $wp_query;
    if ($typenow == 'object' && get_theme_option('allow_suggested')) {
        ?>
        <select class="postform" id="who_created" name="who_created">
Пример #3
0
_e('Descrição', 'consulta');
?>
</label>
        <textarea name="description" id="description"><?php 
echo isset($_POST['description']) ? $_POST['description'] : '';
?>
</textarea>
    </div>
    
    <?php 
if (get_theme_option('enable_taxonomy')) {
    require 'wp-admin/includes/template.php';
    ?>
        <div class="clearfix">
            <label><?php 
    echo ObjectPostType::get_taxonomy_label('name');
    ?>
</label>
            <ul id="object_type">
                <?php 
    wp_terms_checklist(null, array('taxonomy' => 'object_type', 'selected_cats' => $object_types));
    ?>
            </ul>
        </div>
        <?php 
}
?>
    
    <p><input id="new_object_submit" type="submit" value="<?php 
_e('Enviar', 'consulta');
?>