• 04-06-2016, 18:34:09
    #1
    Alıntı
    Fatal error: Cannot redeclare enqueue_scripts() (previously declared in xxxxxxxx/wp-content/themes/caps/inc/ajax-load-more/functions.php:7) in xxxxxxxx/wp-content/plugins/opencart-product-in-wp/ocpwp.php on line 21
    Bu konuda yardımcı olabilecek kimse var mı? Ne yapılması lazım?
    function.php
    <?php
    
    if( !function_exists( 'enqueue_scripts' ) ) {
        function enqueue_scripts() {
        	//Register our JS
    	
    		wp_register_script('ajax-load-more', get_template_directory_uri() . '/inc/ajax-load-more/js/ajax-load-more.js', 'jquery', '1.0', true);
    		// Enqueue CSS
    		wp_enqueue_style( 'ajax-load-more-css', get_template_directory_uri() . '/inc/ajax-load-more/css/ajax-load-more.css' );
    
            // Enqueue our scripts
        	wp_enqueue_script('ajax-load-more');	    	
        }
        
        add_action('wp_enqueue_scripts', 'enqueue_scripts');
    }
    .
    .
    .
    .
    ocpwp.php
    ?php 
    
    /*
    
    	Plugin Name: Opencart Product in WP
    
    	Plugin URI: http://www.rajibdewan.com/opencart-product-wp/
    
    	Description: Plugin for displaying list of Category or Product from external Opencart store
    
    	Author: Md. Rajib Dewan
    
    	Version: 1.0.1
    
    	Author URI: http://www.rajibdewan.com
    
    */
    
    	function ocpwp_admin() {
    
    		include('ocpwp_admin.php'); //21. satır
    .
    .
    .
  • 04-06-2016, 20:10:11
    #2
    Merhaba,

    PHP'de aynı adda iki fonksiyon bulunamaz. Temadaki enqueue_scripts fonksiyon deklarasyonu muhtemelen opencart'takinden önce okunduğu için böyle bir sorun oluyor.

    Tavsiyem, tema yazarken fonksiyon isimleri verirken bir önek eklemek. Örneğin: akar_enqueue_scripts() ya da caps_enqueue_scripts() gibi.
  • 04-06-2016, 21:42:56
    #3
    ruinded adlı üyeden alıntı: mesajı görüntüle
    Merhaba,

    PHP'de aynı adda iki fonksiyon bulunamaz. Temadaki enqueue_scripts fonksiyon deklarasyonu muhtemelen opencart'takinden önce okunduğu için böyle bir sorun oluyor.

    Tavsiyem, tema yazarken fonksiyon isimleri verirken bir önek eklemek. Örneğin: akar_enqueue_scripts() ya da caps_enqueue_scripts() gibi.
    Çok teşekkür ederim... Utandım bunu sorduğuma, çok basit oldu Bu arada da hallettim. Belki birilerinin işini görür bahaneyle.