- Desde
- 13 May 2011
- Mensajes
- 187
Buenas, queria ver quien es capas de solucionar este error en el functions.php supuestamente se arregla borrando los espacios entre <?php y ?> cuando se abren y se cierran de tal manera que seria asi.
No logre solucionarlo, pero se que el error es del functions.php porque al cambiar de theme funciona todo correctamente.
Espero que alguno pueda darme una mano.
functions.php:
Insertar CODE, HTML o PHP:
<?php
?>
<?php
?>
No logre solucionarlo, pero se que el error es del functions.php porque al cambiar de theme funciona todo correctamente.
Espero que alguno pueda darme una mano.
functions.php:
Insertar CODE, HTML o PHP:
<?php
$themename = "ThemeBase";
$shortname = "tb";
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
array_unshift($wp_cats, "Choose a category");
$options = array (
array( "name" => $themename." Options",
"type" => "title"),
array( "name" => "General",
"type" => "section"),
array( "type" => "open"),
array( "name" => "URL de tu logo",
"desc" => "Ingresa el link de tu imagen de logo",
"id" => $shortname."_logo",
"type" => "text",
"std" => ""),
array( "name" => "Proximo",
"desc" => "Ingresa el texto que quieras que salga para ver los proximos posts",
"id" => $shortname."_proximo",
"type" => "text",
"std" => "Ej: Siguiente Video"),
array( "name" => "Anterior",
"desc" => "Ingresa el texto que quieras que salga para ver los posts viejos o anteriores",
"id" => $shortname."_anterior",
"type" => "text",
"std" => "Ej: Video Anterior"),
array( "name" => "Link de facebook",
"desc" => "Ingresa el link para que den like en el header",
"id" => $shortname."_linkfb",
"type" => "text",
"std" => "Ej: www.facebook.com/viceados"),
array( "name" => "Copyright en el footer",
"desc" => "Inserta el contenido que quieras, puede ser HTML",
"id" => $shortname."_footer_text",
"type" => "text",
"std" => get_bloginfo('name') ."© - Rellenalo"),
array( "name" => "Codigo de Google Analytics",
"desc" => "Pega tu tracking code aca y automaticamente se ubicara en el footer.",
"id" => $shortname."_ga_code",
"type" => "textarea",
"std" => ""),
array( "name" => "Favicon",
"desc" => "Un favicon es una imagen de 16x16 pixel que representa tu sitio es una imagen .ico pega la url aca.",
"id" => $shortname."_favicon",
"type" => "text",
"std" => get_bloginfo('url') ."/favicon.ico"),
array( "type" => "close")
);
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("Location: admin.php?page=functions.php&saved=true");
die;
}
else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: admin.php?page=functions.php&reset=true");
die;
}
}
add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');
}
function mytheme_add_init() {
$file_dir=get_bloginfo('template_directory');
wp_enqueue_style("functions", $file_dir."/functions/functions.css", false, "1.0", "all");
wp_enqueue_script("rm_script", $file_dir."/functions/rm_script.js", false, "1.0");
}
function mytheme_admin() {
global $themename, $shortname, $options;
$i=0;
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
?>
<div class="wrap rm_wrap">
<h2>Panel de control de <?php echo $themename; ?></h2>
<div class="rm_opts">
<form method="post">
<?php foreach ($options as $value) {
switch ( $value['type'] ) {
case "open":
?>
<?php break;
case "close":
?>
</div>
</div>
<br />
<?php break;
case "title":
?>
<p>Panel de control de <?php echo $themename;?>, gracias por usar nuestro template!</p>
<?php break;
case 'text':
?>
<div class="rm_input rm_text">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?>" />
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case 'textarea':
?>
<div class="rm_input rm_textarea">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case 'select':
?>
<div class="rm_input rm_select">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?>
<option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>
</select>
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php
break;
case "checkbox":
?>
<div class="rm_input rm_checkbox">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>
<?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>
<input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>
<?php break;
case "section":
$i++;
?>
<div class="rm_section">
<div class="rm_title"><h3><img src="<?php bloginfo('template_directory')?>/functions/plus.png" class="inactive" alt="""><?php echo $value['name']; ?></h3><span class="submit"><input name="save<?php echo $i; ?>" type="submit" value="Guardar cambios" />
</span><div class="clearfix"></div></div>
<div class="rm_options">
<?php break;
}
}
?>
<input type="hidden" name="action" value="save" />
</form>
<form method="post">
<p class="submit">
<input name="reset" type="submit" value="Reset" />
<input type="hidden" name="action" value="reset" />
</p>
</form>
<div style="font-size:9px; margin-bottom:10px;">Desarrollado por: <a href="http://jfgancia.com/">JuanFraGancia</a></div>
</div>
<?php
}
add_action('admin_init', 'mytheme_add_init');
add_action('admin_menu', 'mytheme_add_admin');
//Agregamos soporte para menus personalizados
add_action('init','registrar_menu');
//Registramos un nuevo menu personalizado
function registrar_menu() {
register_nav_menu('menuprincipal', __('Menu Principal'));
}
add_theme_support( 'post-thumbnails' );
add_image_size( 'sidebarpostimage', 100, 100 );
add_image_size( 'sidebarimage', 200, 100 );
add_action('admin_menu', 'custom_fields_video');
function custom_fields_video() {
add_meta_box('video','Url del video','fn_video','post','normal','high');
}
function fn_video() {
global $wpdb, $post;
$value = get_post_meta($post->ID, video, true);
echo '<label for="image_es">URL del video</label>
<input type="text" name="video" id="video" value="'.htmlspecialchars($value).'" style="width: 100px;" />';
}
add_action('publish_post', 'save_videourl');
function save_videourl() {
global $wpdb, $post;
if (!$post_id) $post_id = $_POST['post_ID'];
if (!$post_id) return $post;
$video= $_POST['video'];
update_post_meta($post_id, 'video', $video);
}
// Registro Sidebar
register_sidebar(array(
'name' => 'Sidebar',
'id' => 'Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
'description' => 'Sidebar derecho del sitio'
));
register_sidebar(array(
'name' => 'AdHead',
'id' => 'AdHead',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
'description' => '728x90'
));
register_sidebar(array(
'name' => 'AdPostTop',
'id' => 'AdPostTop',
'before_widget' => '<div class="adtop>"',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
'description' => '590px de ancho maximo'
));
register_sidebar(array(
'name' => 'AdPostBot',
'id' => 'AdPostBot',
'before_widget' => '<div class="adbot>',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
'description' => '590px de ancho maximo'
));
function mpw_create_widget(){
register_widget('mpw_widget');
}
add_action('widgets_init','mpw_create_widget');
class mpw_widget extends WP_Widget {
function mpw_widget(){
$widget_ops = array('classname' => 'mpw_widget', 'description' => "Los ultimos 4 posts" );
$this->WP_Widget('mpw_widget', "Ultimos Posts", $widget_ops);
}
function widget($args,$instance){
echo $before_widget;
?>
<div class="ultimosposts">
<?php if(have_posts()) : ?>
<?php query_posts('cat=1&showposts=4'); while(have_posts()) : the_post(); ?>
<div class="otros">
<div class="thumbnailvideo">
<div class="marcothumb">
<a href="<?php the_permalink()?>"><?php the_post_thumbnail('sidebarimage'); ?></a>
</div>
</div>
<div class="headthumbnail">
<span class="textothumbnail">
<a href="<?php the_permalink()?>"><?php the_title(); ?></a>
</span>
<span class="linkthumbnail">
<a href="<?php the_permalink()?>">Ver mas</a>
</span>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance){
// Función de guardado de opciones
}
function form($instance){
// Formulario de opciones del Widget, que aparece cuando añadimos el Widget a una Sidebar
}
}
?>