• Resolvido Juliana

    (@juliana-silva-theodoro)


    Ola, Boa tarde pessoal, estou tendo problema com o functions php e estou entrando em desespero kkkk

    sou uma aprendiz ainda e estou tentando criar um site em wordpress.

    estou usando os seguintes Plugins : mail-smtp, additional-css, contact-form-to-email, contact-form-7, akismet.

    O tema é o simplue que estou usando.

    Já tentei muda-lo no sql com: UPDATE wp_options SET option_value = ‘twentyeleven’ WHERE option_name = ‘simplue’;

    Aparece o seguinte erro quando tento entrar no site:
    http://aprendiz.url.ph/

    Parse error: syntax error, unexpected T_FUNCTION in /home/u245150648/public_html/wp-content/themes/simplue/functions.php on line 1

    Obrigado!

A visualizar 5 respostas - de 1 a 5 (de um total de 5)
  • Moderador Zé Fontainhas

    (@vanillalounge)

    O que é que tem o functions.php na linha 1 (e seguintes)?

    Thread Starter Juliana

    (@juliana-silva-theodoro)

    <?php
    /**
    
     * Register our sidebars and widgetized areas.
    
     *
    
     */
    
    function simplue_widgets_init() {
    
    	register_sidebar( array(
    
    		'name' => 'Home right sidebar',
    
    		'id' => 'home_right_1',
    
    		'before_widget' => '<div class="boxSide">',
    
    		'after_widget' => '</div>',
    
    		'before_title' => '<h1>',
    
    		'after_title' => '</h1>',
    
    	) );
    
    }
    
    add_action( 'widgets_init', 'simplue_widgets_init' );
    
    add_action( 'after_setup_theme', 'simplue_setup' );
    
    function simplue_setup(){
    
      if ( ! isset( $content_width ) ) $content_width = 700; // pixels
    
      $defaults = array(
    
    	'default-color'          => '',
    
    	'default-image'          => get_template_directory_uri() . '/images/bg.jpg',
    
    	);
    
    	add_theme_support( 'custom-background', $defaults );
    
    	$args = array(
    
    		'flex-width'    => false,
    
    		'width'         => 998,
    
    		'flex-height'    => false,
    
    		'height'        => 180,
    
    		'default-image' => get_template_directory_uri() . '/images/bg-header.png',
    
    	);
    
    	add_theme_support( 'custom-header', $args );
    
    	add_theme_support( 'automatic-feed-links' );
    
    	register_nav_menu( 'main-menu', 'main-menu' );
    
      add_editor_style( 'custom-editor-style.css' );
    
    }
    
      // WP TITLE
    
      function simplue_wp_title( $title, $sep ) {
    
      global $paged, $page;
    
      if ( is_feed() )
    
        return $title;
    
      // Add the site name.
    
      $title .= get_bloginfo( 'name' );
    
      // Add the site description for the home/front page.
    
      $site_description = get_bloginfo( 'description', 'display' );
    
      if ( $site_description && ( is_home() || is_front_page() ) )
    
        $title = "$title $sep $site_description";
    
      // Add a page number if necessary.
    
      if ( $paged >= 2 || $page >= 2 )
    
        $title = "$title $sep " . sprintf( 'Page %s', '', max( $paged, $page ) );
    
      return $title;
    
    }
    
    add_filter( 'wp_title', 'simplue_wp_title', 10, 2 );
    
    // Script style
    
    function simplue_scripts_styles() {
    
      /*
    
       * Adds JavaScript to pages with the comment form to support
    
       * sites with threaded comments (when in use).
    
       */
    
      if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
    
        wp_enqueue_script( 'comment-reply' );
    
      // Loads our main stylesheet.
    
      wp_enqueue_style( 'simplue-style', get_stylesheet_uri() );
    
    }
    
    add_action( 'wp_enqueue_scripts', 'simplue_scripts_styles' );
    
    class simplue_CSS_Menu_Maker_Walker extends Walker {
    
      var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
    
      function start_lvl( &$output, $depth = 0, $args = array() ) {
    
        $indent = str_repeat("\t", $depth);
    
        $output .= "\n$indent
    <ul>\n";
    
      }
      function end_lvl( &$output, $depth = 0, $args = array() ) {
    
        $indent = str_repeat("\t", $depth);
    
        $output .= "$indent</ul>
    \n";
    
      }
    
      function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
    
        global $wp_query;
    
        $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    
        $class_names = $value = ''; 
    
        $classes = empty( $item->classes ) ? array() : (array) $item->classes;
    
        /* Add active class */
    
        if(in_array('current-menu-item', $classes)) {
    
          $classes[] = 'active';
    
          unset($classes['current-menu-item']);
    
        }
    
        /* Check for children */
    
        $children = get_posts(array('post_type' => 'nav_menu_item', 'nopaging' => true, 'numberposts' => 1, 'meta_key' => '_menu_item_menu_item_parent', 'meta_value' => $item->ID));
    
        if (!empty($children)) {
    
          $classes[] = 'has-sub';
    
        }
    
        $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
    
        $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
    
        $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
    
        $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
    
        $output .= $indent . '<li' . $id . $value . $class_names .'>';
    
        $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
    
        $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
    
        $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
    
        $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
    
        $item_output = $args->before;
    
        $item_output .= '<a'. $attributes .'>';
    
        $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    
        $item_output .= '';
    
        $item_output .= $args->after;
    
        $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
    
      }
    
      function end_el( &$output, $item, $depth = 0, $args = array() ) {
    
        $output .= "\n";
    
      }
    
    }
    
    // Single navigation
    
    function simplue_post_nav() {
    
      global $post;
    
      // Don't print empty markup if there's nowhere to navigate.
    
      $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
    
      $next     = get_adjacent_post( false, '', false );
    
      if ( ! $next && ! $previous )
    
        return;
    
     }
    
      <div id="navSingle">
    
          <div class="aPrev"><?php previous_post_link( '%link', '<span class="meta-nav">←</span> %title', 'Previous post link', 'simplue' ); ?></div>
    
          <div class="aNext"><?php next_post_link( '%link', '%title <span class="meta-nav">→</span>', 'Next post link', 'simplue' ); ?></div>
    
      </div><!-- navSingle -->
    
    ?>

    Olá Juliana Silva Theodoro,

    Olhei rapidamente para o código (sem o analisar muito) e parace-me que o html que tens no fim do ficheiro deveria estar dentro da função simplue_post_nav().

    // Single navigation
    function simplue_post_nav() {
    global $post;
    
    // Don't print empty markup if there's nowhere to navigate.
    $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
    
    $next = get_adjacent_post( false, '', false );
    if ( ! $next && ! $previous )
    return;
    
    ?>
    
    <div id="navSingle">
    <div class="aPrev"><?php previous_post_link( '%link', '<span class="meta-nav">←</span> %title', 'Previous post link', 'simplue' ); ?></div>
    <div class="aNext"><?php next_post_link( '%link', '%title <span class="meta-nav">→</span>', 'Next post link', 'simplue' ); ?></div>
    </div><!-- navSingle -->
    
    <?php
    }
    ?>

    Espero que seja só isso! Experimenta e dá um feedback…

    Thread Starter Juliana

    (@juliana-silva-theodoro)

    Ola, eu reinstalei o WordPress e fiz o upload do tema e enviei ftp e resolveu. Mas obrigado vlw! 🙂

    Thread Starter Juliana

    (@juliana-silva-theodoro)

    acabou

A visualizar 5 respostas - de 1 a 5 (de um total de 5)
  • O tópico ‘Problemas com o functions.php’ está fechado a novas respostas.