This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# задача: приложение реализовать на Yii, а статьи публиковать в Wordpress и всё это на одном адресе и на одном порту : http://icons8.com/ | |
# обсуждается на хабре http://habrahabr.ru/company/dataart/blog/236635/ | |
# там же ссылки ещё на 5 примеров интеграции Wordpress и Yii | |
# конфиг верхнего уровня для перенаправления запросов на приложение Yii или блог wordpress | |
server { | |
listen 80; | |
#server_name icons8.com; | |
#error_log /var/log/icons8.com/error.log; | |
#access_log /var/log/icons8.com/access.log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
// Adicionar login/logout ao menu principal | |
// 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 == 'primary') { | |
// $items .= '<li><a href="'. wp_logout_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) .'">Log Out</a></li>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
// Adicionar login/logout ao menu principal | |
// 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 == 'primary') { | |
// $items .= '<li><a href="'. wp_logout_url( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) .'">Log Out</a></li>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_loop_add_to_cart_link', 'mw_change_add_to_cart_loop' ); | |
function mw_change_add_to_cart_loop( $product ) { | |
global $product; // this may not be necessary as it should have pulled the object in already | |
return '<a class="button" href="' . esc_url( $product->get_permalink( $product->id ) ) . '">DETALHES</a>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'genesis_nav_items', 'be_follow_icons', 10, 2 ); | |
add_filter( 'wp_nav_menu_items', 'be_follow_icons', 10, 2 ); | |
/** | |
* Follow Icons in Menu | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/genesis-wordpress-nav-menu-content/ | |
* | |
* @param string $menu | |
* @param array $args | |
* @return string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_after', 'mw_add_offcanvas' ); | |
function mw_add_offcanvas() | |
{ | |
$out = '<div class="shifter-navigation Sidebar-offcanvas">'; | |
/** | |
* Using this hook: | |
* mw_add_offcanvas_sidebar | |
* mw_offcanvas_menu | |
*/ | |
ob_start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_meta', 'mw_force_woo_pages_layout' ); | |
function mw_force_woo_pages_layout() { | |
if ( is_woocommerce() ) { | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 ); | |
function your_custom_menu_item ( $items, $args ) { | |
if ($args->theme_location == 'header') { | |
$items .= '<li class="menu-item"><a id="openOptionsSidebar" class="shifter-handle">More</a></li>'; | |
} | |
return $items; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'product', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( // Simple products type | |
'key' => '_sale_price', | |
'value' => 0, | |
'compare' => '>', | |
'type' => 'numeric' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'product', | |
'meta_key' => '_featured', | |
'meta_value' => 'yes', | |
'posts_per_page' => 6 | |
); | |
$featured_query = new WP_Query( $args ); | |
if ($featured_query->have_posts()) : | |
?> |