Skip to content

Instantly share code, notes, and snippets.

@AlexL-JWA
AlexL-JWA / menu php
Created Mar 22, 2019
WP Вывод menu
View menu php
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',
@AlexL-JWA
AlexL-JWA / functions.php
Created Mar 6, 2019
Регистрация меню Wp
View functions.php
add_action( 'after_setup_theme', 'theme_register_nav_menu' );
function theme_register_nav_menu() {
register_nav_menu( 'primary', 'Primary Menu' );
}
@AlexL-JWA
AlexL-JWA / Подключение скриптов
Created Mar 6, 2019
Подключение скриптов Wp
View Подключение скриптов
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');
}
View functions.php
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
View functions.php
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
@AlexL-JWA
AlexL-JWA / style.css
Created Sep 24, 2018
Регистрация темы style.css
View 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
*/
@AlexL-JWA
AlexL-JWA / functions.php
Created Aug 26, 2018
добавление логин логаут в меню WP
View functions.php
// 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 / .htaccess
Created Aug 26, 2018
new httacess WP
View .htaccess
# 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 / terms-page.php
Created Aug 17, 2018
обявление шаблона WP
View terms-page.php
<?php
/**
* Template Name: Terms Page
*/
?>
@AlexL-JWA
AlexL-JWA / functions.php
Created Aug 1, 2018
Убрать траиточие из the_excerpt
View functions.php
add_filter('excerpt_more', function($more) {
return '...';
});
You can’t perform that action at this time.