Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter bgcyam

    (@bgcyam)

    Thanks so much for all your help… sadly I still can’t get this to work. Not sure where I am going wrong.

    Since I am not using function.php in my child theme for anything else, I just created a new php file & placed your above code 9with the open/close tags — oops) in it, before uploading it to the child theme folder on my server. Unfortunately, the Read Mores still did not show up for the relevant posts. ??

    Thread Starter bgcyam

    (@bgcyam)

    Okay, when I tried adding the new function to functions.php in the child theme, the Read Mores still did not appear. The top of the page showed the code instead: function sparkling_excerpt_more( $more ) { return ' ' . __('READ MORE', 'SPARKLING') . ''; } add_filter( 'excerpt_more', 'sparkling_excerpt_more' );"\

    So I thought maybe it was because that was the only code in my functions.php file. When I tried cloning the functions.php file & adding it to my child-theme folder (with the new code added), I got this:

    Fatal error: Cannot redeclare sparkling_content_width() (previously declared in /home/chimer/public_html/browngirlcomics.com/wp-content/themes/sparkling-child/functions.php:19) in /home/chimer/public_html/browngirlcomics.com/wp-content/themes/sparkling/functions.php on line 23

    At which point I added it to the parent function.php file. Fortunately, no errors appeared… but the read mores are still absent. :S

    The site is browngirlcomics dot com, by the way.

    Thread Starter bgcyam

    (@bgcyam)

    Thanks! The first step was fine, but the second step is not working for me. I either get major errors (resulting in the whole site breaking), or just… nothing at all.

    Thread Starter bgcyam

    (@bgcyam)

    This is the code I’m using now:

    <?php
    
    /**
     * Function to remove default slider scripts
     */
    function sparkling_dequeue_script() {
        wp_dequeue_script( 'flexslider-customization' );
        wp_dequeue_script( 'flexslider-js' );
    }
    add_action( 'wp_print_scripts', 'sparkling_dequeue_script', 100 
    
    );
    
    /**
     * Function to remove default slider CSS.
    */
    function sparkling_dequeue_style() {
        wp_dequeue_style( 'flexslider-css' );
    }
    add_action( 'wp_print_styles', 'sparkling_dequeue_style', 100 );
    
    // Add slider CSS only if is front page ans slider is enabled
    
    if( ( of_get_option('sparkling_slider_checkbox') == 1 ) { 
    
    wp_enqueue_style( 'flexslider-css', get_template_directory_uri
    
    ().'/inc/css/flexslider.css' );
      }
    
    // Add slider JS only if is front page ans slider is enabled
    
    if( ( of_get_option('sparkling_slider_checkbox') == 1 ) 
    
    wp_enqueue_script( 'flexslider-js', get_template_directory_uri() 
    
    . '/inc/js/flexslider.min.js', array('jquery'), '20140222', true 
    
    );
    	}
    
    // Flexslider customization
      if( ( of_get_option
    
    ('sparkling_slider_checkbox') == 1 ) {
        wp_enqueue_script( 
    
    'flexslider-customization', get_template_directory_uri() . 
    
    '/inc/js/flexslider-custom.js', array('jquery', 'flexslider-js'), 
    
    '20140716', true );
      }
    
    /**
    
    * Featured image slider, displayed on front page for static page 
    
    and blog
    
    */
    
    function sparkling_featured_slider() {
      if ( of_get_option( 
    
    'sparkling_slider_checkbox' ) == 1 ) {    echo '<div 
    
    class="flexslider">';
          echo '<ul class="slides">';
    
    $count = of_get_option( 'sparkling_slide_number' );
    
    $slidecat =of_get_option( 'sparkling_slide_categories' );
    
    $query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' 
    
    =>$count ) );
            if ($query->have_posts()) :
              while 
    
    ($query->have_posts()) : $query->the_post();
    
              echo 
    
    '<li>';
                if ( (function_exists( 'has_post_thumbnail' )) 
    
    && ( has_post_thumbnail() ) ) :
                  echo 
    
    get_the_post_thumbnail();
                endif;
    
                  echo 
    
    '<div class="flex-caption">';
                    echo '<a href="'. 
    
    get_permalink() .'">';
                      if ( get_the_title() != 
    
    '' ) echo '<h2 class="entry-title">'. get_the_title().'</h2>';
    
                  if ( get_the_excerpt() != '' ) echo '<div 
    
    class="excerpt">' . get_the_excerpt() .'</div>';
    
    echo '</a>';
                  echo '</div>';
    
                  endwhile;
    
             endif;
    
              echo '</li>';
          echo '</ul>';
        echo 
    
    ' </div>';
      }
    }

    I get the error: Parse error: syntax error, unexpected ‘{‘ in /[…]/wp-content/themes/sparkling-child/functions.php on line 22

    Thread Starter bgcyam

    (@bgcyam)

    Thanks so much. I still can’t get this to work. Could there be an error in my original code to load the scrips on all the pages?

Viewing 5 replies - 1 through 5 (of 5 total)