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 } } }
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; }
<?php global $wp_query; $pagina = isset($_GET['pagina']) ? $_GET['pagina'] : 1; ?> <?php if (have_posts()) { ?> <div class="[ row ] grid"> <?php while (have_posts()) { the_post(); $url_img = attachment_image_url($post->ID, 'medium'); $class = ''; $ingredientes = getIngredientsShip($post->ID); if (!empty($ingredientes)) { foreach ($ingredientes as $ingrediente) { $class .= ' ingrediente-' . $ingrediente->ingrediente_id; ?> <?php } } ?> <div class="[ box-content ][ col-xs-6 col-sm-4 col-lg-3 ] element-item <?php echo $class; ?> "> <a href="<?php the_permalink();
<div class="input-group"> <input type="text" name="search" class="[ form-control ][ input-search ][ ]"> <span class="[ input-group-btn ][ ]"> <button class="[ input-search--button ][ btn-secondary ][ no-margin padding--small ]" type="submit"> <img class="[ svg icon--iconed--large icon--stroke icon--responsive ][ color-light ]" src="<?php echo THEMEPATH; ?> icons/search.svg"> </button> </span> </div> </form> </div> </div> <?php $ingrTemporada = getIngredientsShip(0); ?> </div> </div> <div class="[ container ]"> <p class="[ no-margin ][ text-center ]"> Esta temporada cocinamos con: <?php if (!empty($ingrTemporada)) { $TotIng = count($ingrTemporada) - 1; foreach ($ingrTemporada as $key => $ingrediente) { $post_data = get_post($ingrediente->ingrediente_id); $coma = $TotIng != $key ? ',' : ''; ?> <a href="<?php echo site_url('recetas/?ingrediente=') . $post_data->post_name;