Задать вопрос
Ответы пользователя по тегу PHP
  • Wordpress + Woocommerce где найти шаблон категории?

    @max3wq
    Здравствуйте, скорее всего если archive-product.php не принимает изменений в шаблоне есть файл woocommerce.php, но это не важно, просто открываем /wp-content/plugins/woocommerce/templates/archive-product.php
    Смотрим название интересующей позиции и ее номер, и в functions.php вставляем то что нужно добавить в шаблон категории.

    //Добавление чего либо перед товарами
    add_action( 'woocommerce_before_shop_loop', 'add_my_f', 5);
    function add_my_f() {
    echo ('111'); 
    }
    Ответ написан
    Комментировать
  • Где в WP подключается родной jquery?

    @max3wq
    WP 5.6
    wp-includes/functions.wp-scripts.php

    function wp_deregister_script( $handle ) {
    	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
    
    	/**
    	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
    	 * Show minimal remorse if the correct hook is used.
    	 */
    	$current_filter = current_filter();
    	if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
    		( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
    	) {
    		$not_allowed = array(
    			'jquery',
    			'jquery-core',
    			'jquery-migrate',
    			'jquery-ui-core',
    			'jquery-ui-accordion',
    			'jquery-ui-autocomplete',
    			'jquery-ui-button',
    			'jquery-ui-datepicker',
    			'jquery-ui-dialog',
    			'jquery-ui-draggable',
    			'jquery-ui-droppable',
    			'jquery-ui-menu',
    			'jquery-ui-mouse',
    			'jquery-ui-position',
    			'jquery-ui-progressbar',
    			'jquery-ui-resizable',
    			'jquery-ui-selectable',
    			'jquery-ui-slider',
    			'jquery-ui-sortable',
    			'jquery-ui-spinner',
    			'jquery-ui-tabs',
    			'jquery-ui-tooltip',
    			'jquery-ui-widget',
    			'underscore',
    			'backbone',
    		);
    
    		if ( in_array( $handle, $not_allowed, true ) ) {
    			$message = sprintf(
    				/* translators: 1: Script name, 2: wp_enqueue_scripts */
    				__( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
    				"<code>$handle</code>",
    				'<code>wp_enqueue_scripts</code>'
    			);
    			_doing_it_wrong( __FUNCTION__, $message, '3.6.0' );
    			return;
    		}
    	}
    
    	wp_scripts()->remove( $handle );
    }
    Ответ написан
    Комментировать
  • Тормозит wordpress. Какая может быть ошибка в этом коде?

    @max3wq
    Очень хороший метод узнать что грузит - использовать бесплатный плагин query-monitor. Он вам покажет какой файл шаблона и какая функция генерит долгое время загрузки. Медленные запросы к БД, скрипты и многое другое.
    Ответ написан
    Комментировать