Codeless
  • Support Home
  • Themes
  • Support
  • WordPress Tutorials
    • How to Start a Blog
    • Best Website Builders
    • Best Small Business Hosting
    • Email Marketing Services
    • Cheap WordPress Hosting
  • Video Tutorials

Community Forums

Cannot redeclare function error message

    • 9 years, 8 months ago armand88
      Participant

      Expired

      Hello,

      I’m trying to make my customizations in a child theme.  To test, I tried to override the codeless_images_sizes() function.  I copied the function from specular to my child theme folder.  The functions.php in my child theme looks like this:

      <?php

      function child_enqueue_scripts() {
      wp_register_style( ‘childtheme_style’, get_stylesheet_directory_uri() . ‘/style.css’  );
      wp_enqueue_style( ‘childtheme_style’ );
      }

      add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_scripts’);

      function codeless_images_sizes(){
      add_image_size( ‘port3’, 600, 600, true );
      add_image_size( ‘port3_grayscale’, 627, 470, true );
      add_image_size( ‘port2’, 460, 275, true );
      add_image_size( ‘port2_grayscale’, 940, 470, true );
      add_image_size( ‘port4’, 600, 600, true );
      add_image_size( ‘blog’, 825, 340, true );
      add_image_size( ‘alternate_blog’, 440, 195, true );
      add_image_size( ‘alternate_blog_side’, 355, 235, true );
      add_image_size( ‘blog_grid’, 350, 350, true );
      add_image_size( ‘staff’, 400, 270, true );
      add_image_size( ‘staff_full’, 500, 340, true );
      }

      ?>

      When I try to access the site, I get this error message:

      Fatal error: Cannot redeclare codeless_images_sizes() …

      Please advise what else I need to do to override specular theme functions in my child theme.  Thanks.

       

    • 9 years, 8 months ago Mirela
      Participant

      Hello,

      Please follow the instructions of this article for more: https://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623
      Let us know.

      Best regards!

    • 9 years, 8 months ago armand88
      Participant

      Expired

      thank you. that was helpful.

Viewing 2 reply threads

You must be logged in to reply to this topic.

Login

Log In
Register

Renew Support

  • Renew Specular Support
  • Renew Tower Support
  • Renew Folie Support
  • Renew Handel Support
  • Renew June Support
  • Renew Picante Support
  • Renew Thype Support
  • Renew Regn Support

Search Forums

Forums

  • Bygge – Construction Theme
  • Converta – Software Theme
  • Folie – The WordPress Website Builder
  • Handel – Responsive Multi-Purpose Business Theme
  • June WooCommerce WordPress Theme
  • Livecast – Podcast Theme
  • Picante – Restaurant & Food WordPress Theme
  • Regn | Agency & Business WordPress Theme
  • Remake – Minimal Portfolio & Agency Theme
  • Specular – Multi-Purpose WordPress Theme
  • Suggest us Features
  • Tower – Business-Driven Multipurpose WP Theme
  • Vibrance – Photography Theme

Site Links

  • Support Policy
  • Specular Support Forum
  • Video Tutorials
  • Knowledge Base
  • Guides and Reviews

Useful Articles

  • Build a Website
  • Web Design & Development
  • Hosting
  • WordPress

Login

Log In
Register Lost Password