コード例 #1
0
ファイル: metaboxes.php プロジェクト: pcuervo/wp-yolcan
function show_metabox_ingredientes_receta($post)
{
    wp_nonce_field(__FILE__, 'ingredientes_nonce');
    $ingredientes = new WP_Query(['post_type' => 'ingredientes', 'posts_per_page' => -1]);
    if (!empty($ingredientes->posts)) {
        $activitisShip = orderIndexObject(getIngredientsShip($post->ID));
        foreach ($ingredientes->posts as $ingrediente) {
            $checked = isset($activitisShip[$ingrediente->ID]) ? 'checked' : '';
            ?>

	 		<input type="checkbox" name="ingredientes[]" id="ingredientes[]" value="<?php 
            echo $ingrediente->ID;
            ?>
" <?php 
            echo $checked;
            ?>
 /> <?php 
            echo $ingrediente->post_title;
            ?>
<br><br>

	 	<?php 
        }
    }
}
コード例 #2
0
ファイル: post-types.php プロジェクト: pcuervo/wp-yolcan
function ingresients_submenu_page_callback()
{
    if (isset($_POST['action']) and $_POST['action'] == 'ingredientes-temporada') {
        saveSeasonalIngredients($_POST);
    }
    $html = '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
    $html .= '<h2>Ingredientes de temporada</h2>';
    $html .= '</div><br>';
    $html .= '<div class="container-ingredients">';
    $html .= '<form action="" method="POST">';
    $ingredientes = new WP_Query(['post_type' => 'ingredientes', 'posts_per_page' => -1]);
    if (!empty($ingredientes->posts)) {
        $activitisShip = orderIndexObject(getIngredientsShip(0));
        foreach ($ingredientes->posts as $ingrediente) {
            $checked = isset($activitisShip[$ingrediente->ID]) ? 'checked' : '';
            $html .= '<div class="container-ingredient">';
            $html .= '<input type="checkbox" name="ingredientesTemporada[]" id="ingredientesTemporada[]" value="' . $ingrediente->ID . '" ' . $checked . ' /> ' . $ingrediente->post_name . ' <br><br>';
            $html .= '</div>';
        }
    }
    $html .= '<input type="hidden" value="ingredientes-temporada" name="action" >';
    $html .= '<input type="submit" value="Guardar" class="button-primary button-large button-clear" >';
    $html .= '</form>';
    $html .= '</div>';
    echo $html;
}
コード例 #3
0
ファイル: metaboxes.php プロジェクト: pcuervo/wp-carnival
/**
 * ÁREAS PÚBLICAS
 */
function show_metabox_areas_publicas($post)
{
    wp_nonce_field(__FILE__, 'areas_publicas_nonce');
    $activities = new WP_Query(['post_type' => 'actividades', 'posts_per_page' => -1]);
    if (!empty($activities->posts)) {
        $activitisShip = orderIndexObject(getActivitisShip($post->ID));
        foreach ($activities->posts as $activity) {
            $checked = isset($activitisShip[$activity->ID]) ? 'checked' : '';
            ?>

	 		<input type="checkbox" name="activities[]" id="activities[]" value="<?php 
            echo $activity->ID;
            ?>
" <?php 
            echo $checked;
            ?>
 /> <?php 
            echo $activity->post_name;
            ?>
<br><br>

	 	<?php 
        }
    }
}