Cómo agregar un buscador en el header del theme

  • Autor Autor seam_24
  • Fecha de inicio Fecha de inicio
S

seam_24

Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola amigos, quiero poner un buscador en la parte derecha del header de mi blog pero no se donde poner el código lo he intentado pero no he podido. Quiero que quedo como en mi otro blog o más menos así.

El código del buscador:

PHP:
<form action='http://www.google.es/cse' id='cse-search-box'>
  <div>
    <input name='cx' type='hidden' value='partner-pub-0382424156755199:m40pr2i3rbj'/>
    <input name='ie' type='hidden' value='ISO-8859-1'/>
    <input name='q' size='25' type='text'/>
    <input name='sa' type='submit' value='Buscar'/>
  </div>
</form>
<script src='http://www.google.es/cse/brand?form=cse-search-box&amp;lang=es' type='text/javascript'/> 

    </div>

El código header php:


PHP:
<?php global $traction; ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <?php if ( is_front_page() ) : ?> 
        <title><?php bloginfo( 'name' ); ?></title> 
    <?php elseif ( is_404() ) : ?> 
        <title><?php _e( 'Page Not Found |', 'traction' ); ?> | <?php bloginfo( 'name' ); ?></title> 
    <?php elseif ( is_search() ) : ?> 
        <title><?php printf(__ ("Search results for '%s'", "traction"), attribute_escape(get_search_query())); ?> | <?php bloginfo( 'name' ); ?></title> 
    <?php else : ?> 
        <title><?php wp_title($sep = '' ); ?> | <?php bloginfo( 'name' );?></title> 
    <?php endif; ?> 

    <!-- Basic Meta Data --> 
    <meta name="Copyright" content="Design is copyright <?php echo date( 'Y' ); ?> The Theme Foundry" /> 
    <meta http-equiv="imagetoolbar" content="no" /> 
    <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" /> 
    <?php if ((is_single() || is_category() || is_page() || is_home()) && (!is_paged())) : else : ?> 
        <meta name="robots" content="noindex,follow" /> 
    <?php endif; ?> 

    <!-- Favicon --> 
    <link rel="shortcut icon" href="<?php bloginfo( 'stylesheet_directory' ); ?>/images/favicon.ico" /> 

    <!--Stylesheets--> 
    <link href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" rel="stylesheet" /> 
    <!--[if lt IE 8]> 
        <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo( 'template_url' ); ?>/stylesheets/ie.css" /> 
    <![endif]--> 

    <!--WordPress--> 
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?> RSS Feed" href="<?php bloginfo( 'rss2_url' ); ?>" /> 
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 

    <!--WP Hooks--> 
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> 
    <?php wp_enqueue_script( 'jquery' ); ?> 
    <?php wp_head(); ?> 

    <!--Scripts--> 
    <script type="text/javascript" src="<?php bloginfo( 'template_url' ); ?>/javascripts/traction.js"></script> 
    <?php if ( is_front_page() && ($traction->sliderState() != '' ) ) { ?> 
        <!--Slider--> 
        <?php 
         $autoStart = 0; 
         $slidespeed = 300; 
         $fadespeed = 200; 
         if ($traction->sliderSpeed() != '' ) $slidespeed = $traction->sliderSpeed(); 
         if ($traction->sliderFade() != '' ) $fadespeed = $traction->sliderFade(); 
         if ($traction->sliderStart() == 'true' ) $autoStart = $traction->sliderDelay(); else $autoStart = 0; 
        ?> 
        <script type="text/javascript" charset="utf-8"> 
            jQuery(function(){ 
                jQuery("#feature").loopedSlider({ 
                    containerClick: false, 
                    autoStart: <?php echo $autoStart; ?>, 
                    slidespeed: <?php echo $slidespeed; ?>, 
                    fadespeed: <?php echo $fadespeed; ?>, 
                    autoHeight: 1 
                }); 
            }); 
        </script> 
    <?php } ?> 
</head> 
<body> 
    <div class="skip-content"><a href="#content"><?php _e( 'Skip to content', 'traction' ); ?></a></div> 
    <div id="pg-nav-bg"> 
        <div class="wrapper clear"> 
            <div id="pg-nav"> 
                <ul class="nav"> 
                    <li class="page_item <?php if (is_front_page()) echo( 'current_page_item' );?>"><a href="<?php bloginfo( 'url' ); ?>"><?php _e( 'Home', 'traction' ); ?></a></li> 
                    <?php if ($traction->hidePages() !== 'true' ) : ?> 
                        <?php wp_list_pages( 'title_li=' ); ?> 
                    <?php endif; ?> 
                </ul> 
            </div><!--end page-navigation--> 
        </div><!--end wrapper--> 
    </div><!--end page-navigation-bg--> 
    <div class="wrapper big"> 
        <div id="header" class="clear"> 
            <div class="logo"> 
                <?php if (is_home()) echo( '<h1 id="title">' ); else echo( '<div id="title">' );?><a href="<?php bloginfo( 'url' ); ?>"><?php bloginfo( 'name' ); ?></a><?php if (is_home()) echo( '</h1>' ); else echo( '</div>' );?> 
                <div id="description"> 
                    <?php bloginfo( 'description' ); ?> 
                </div><!--end description--> 
            </div><!--end logo--> 
            <div id="cat-nav" class="clear"> 
                <ul class="nav"> 
                    <?php if ($traction->hideCategories() != 'true' ) : ?> 
                        <?php wp_list_categories( 'title_li=' ); ?> 
                    <?php endif; ?> 
                </ul> 
            </div><!--end navigation--> 
        </div><!--end header--> 
        <?php if (($traction->sliderState() != '' ) && is_home() && !is_paged() ) { ?> 
            <?php if (is_file(STYLESHEETPATH . '/featured.php' )) include(STYLESHEETPATH . '/featured.php' ); else include(TEMPLATEPATH . '/featured.php' ); ?> 
        <?php } ?>

Bueno espero que me puedan ayudar, ya que lo intento pero no he podido.

Saludos!
 
Ya he podido poner el buscador, lo he puesto en Sidebar php al final, pero el problema es que ahora no se me ve los créditos del footer. Alguien me puede ayudar. Pueden verlo aquí.

Código Sidebar php:

<?php global $traction; ?>
<div id="sidebar">
<?php if ($traction->sideboxState() != 'true' ) {?>
<div id="sidebox">
<?php if ($traction->sideboxCustom() == 'true' ) : ?>
<?php echo $traction->sideboxCode(); ?>
<?php else : ?>
<a href="/"><img src="<?php bloginfo( 'template_url' ); ?>/images/sidebar/sidebox.jpg" width="250" height="200" alt="Traction WordPress Theme" /></a>
<?php endif; ?>
</div><!--end sidebox-->
<?php } ?>
<?php if ($traction->adboxState() == 'true' ) { ?>
<div id="adbox" class="clear">
<a href="<?php if ($traction->adboxUrl1() != '' ) echo $traction->adboxUrl1(); else echo "#"; ?>"><img class="alignleft" src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/ads/<?php if ($traction->adboxImage1() != '' ) echo $traction->adboxImage1(); else echo "125_ad.png"; ?>" width="125" height="125" alt="<?php if ($traction->adboxAlt1() != '' ) echo $traction->adboxAlt1(); else echo bloginfo( 'name' ); ?>" /></a>
<a href="<?php if ($traction->adboxUrl2() != '' ) echo $traction->adboxUrl2(); else echo "#"; ?>"><img class="alignright" src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/ads/<?php if ($traction->adboxImage2() != '' ) echo $traction->adboxImage2(); else echo "125_ad.png"; ?>" width="125" height="125" alt="<?php if ($traction->adboxAlt2() != '' ) echo $traction->adboxAlt2(); else echo bloginfo( 'name' ); ?>" /></a>
</div><!--end adbox-->
<?php } ?>
<?php if ($traction->news() == 'true' ) { ?>
<div id="newsletter">
<h3><?php if ($traction->newsTitle() != '' ) echo $traction->newsTitle(); else echo _e( 'Sign up for our free newsletter', 'traction' ); ?></h3>
<form class="newsletter" action="http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $traction->newsName(); ?>" method="post">
<div>
<input id="news-email" class="text" name="email" type="text" value="<?php _e( 'Introduzca su correo', 'traction' ); ?>" onfocus="if (this.value == '<?php _e( 'Introduzca su correo', 'traction' ); ?>' ) {this.value = '';}" onblur="if (this.value == '' ) {this.value = '<?php _e( 'Email address', 'traction' ); ?>';}" />
<input id="news-button" type="image" src="<?php bloginfo( 'template_url' ); ?>/images/newsletter-go.png" alt="<?php _e( 'Go', 'traction' ); ?>" class="button" value="Go" />
</div>
</form>
</div><!--end newsletter-->
<?php } ?>
<?php if ($traction->twitterState() == 'true' ) { ?>
<div class="widget twitter">
<h2 class="widgettitle"><?php _e( 'Twitter', 'traction' ); ?> <a href="http://twitter.com/<?php echo $traction->twitter(); ?>"><?php echo $traction->twitter(); ?></a></h2>
<div class="tweet">
<?php twitter_messages($traction->twitter(), $traction->twitterUpdates(), true, true, true, false, true, true); ;?>
</div>
</div><!--end twitter-->
<?php } ?>
<?php if ( is_active_sidebar( 'normal_sidebar' ) ) echo "<ul>" ?>
<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'normal_sidebar' ) ) : ?>
<ul>
<li class="widget widget_recent_entries">
<h2 class="widgettitle"><?php _e( 'Recent Articles', 'traction' ); ?></h2>
<ul>
<?php $side_posts = get_posts( 'numberposts=10' ); foreach($side_posts as $post) : ?>
<li><a href= "<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</li>
<li class="widget widget_meta">
<h2 class="widgettitle"><?php _e( 'Archives', 'traction' ); ?></h2>
<ul>
<?php wp_get_archives(); ?>
</ul>
</li>
</ul>
<?php endif; ?>
<?php if ( is_active_sidebar( 'normal_sidebar' ) ) echo "</ul>" ?>
</div><!--end sidebar-->
<div id='NavbarMenuright'>
<form action='http://www.google.es/cse' id='cse-search-box'>
<div>
<input name='cx' type='hidden' value='partner-pub-0382424156755199:m40pr2i3rbj'/>
<input name='ie' type='hidden' value='ISO-8859-1'/>
<input name='q' size='60' type='text'/>
<input name='sa' type='submit' value='Buscar'/>
</div>
</form>
<script src='http://www.google.es/cse/brand?form=cse-search-box&amp;lang=es' type='text/javascript'/>
</div>
</div>


Lo que está en color azul es el código del buscador. Una ayudita por favor.

Saludos!
 
Última edición:
No lo has metido en sidebar, sino en el footer, o por ahí perdido. Creo que la línea justo encima de lo azul
Insertar CODE, HTML o PHP:
</div><!--end sidebar-->
Debes ponerla al final del todo, debajo de lo azul. Puede que por eso te haya estropeado el footer.

A ver si te ayuda, que lo de programar no es lo mío!
 
Última edición:
Atrás
Arriba