Skip to content

Instantly share code, notes, and snippets.

View AlexL-JWA's full-sized avatar

Aleksandr Lavigin AlexL-JWA

View GitHub Profile
@AlexL-JWA
AlexL-JWA / .htaccess
Created August 26, 2018 16:46
new httacess WP
# BEGIN WordPress
#Order Allow,Deny
#Deny from all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@AlexL-JWA
AlexL-JWA / functions.php
Created August 26, 2018 17:16
добавление логин логаут в меню WP
// Filter output menu add sign in / sign out
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'header_menu') {
$items .= '<li><a href="'. wp_logout_url(home_url()) .'"><i class="icon-user-login-button"></i><span>Выйти</span></a></li>';
}
elseif (!is_user_logged_in() && $args->theme_location == 'header_menu') {
$items .= '<li><a data-fancybox="" data-animation-duration="700" data-src="#register-popup" href="javascript:;"><i class="icon-Registration-01"></i><span>Регистрация</span></a></li>';
$items .= '<li><a data-fancybox="" data-animation-duration="700" data-src="#login-popup" href="javascript:;"><i class="icon-user-login-button"></i><span>Войти</span></a></li>';
}
@AlexL-JWA
AlexL-JWA / style.css
Created September 24, 2018 12:57
Регистрация темы style.css
/*
Theme Name: La Strada
Theme URI: http://alscon-web.com
Author: Alex Lavihyn
Author URI: https://www.upwork.com/freelancers/~015d44c720e5f4462a
Description: Theme for the restaurant La Strada city Kharkiv
Version: 1.0
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
@AlexL-JWA
AlexL-JWA / functions.php
Created January 11, 2019 22:26
ACF Option page
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
@AlexL-JWA
AlexL-JWA / Подключение скриптов
Created March 6, 2019 09:18
Подключение скриптов Wp
add_action( 'wp_enqueue_scripts', 'theme_add_scripts' );
function theme_add_scripts() {
//add scripts
wp_enqueue_script( 'main-js', get_template_directory_uri() .'/js/build.js', array('jquery'), '1.0', true );
//add style
wp_enqueue_style( 'main-style', get_template_directory_uri() .'/css/main.css');
}
@AlexL-JWA
AlexL-JWA / functions.php
Created March 6, 2019 09:19
Регистрация меню Wp
add_action( 'after_setup_theme', 'theme_register_nav_menu' );
function theme_register_nav_menu() {
register_nav_menu( 'primary', 'Primary Menu' );
}
@AlexL-JWA
AlexL-JWA / menu php
Created March 22, 2019 15:09
WP Вывод menu
wp_nav_menu( [
'theme_location' => 'primary',
'menu' => 'Menu',
'container' => '',
'container_class' => '',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',