php 更改存档布局

更改存档布局

avia-archive-layout.php
/**
	 * Modify Archive Pages to Display as Grid View
	 */
	add_filter('avf_blog_style','yanco_avia_change_category_blog_layout', 10, 2); 
	function yanco_avia_change_category_blog_layout($layout, $context) {
		if($context == 'archive') {
			$layout = 'blog-grid';
		}

		if($contect == 'tag') {
			$layout = 'blog-grid';
		}

		return $layout;
	}

php Enfold,relatedposts短代码

Enfold,relatedposts短代码

related-posts-shortcode.php
/**
 * Related Posts Shortcode
 */
function yanco_related_posts_shortcode( $atts ) {
	ob_start();
    get_template_part( 'includes/related-posts');
    $related_posts_obj = ob_get_contents();
    ob_end_clean();
    return $related_posts_obj;
}
add_shortcode( 'related_posts', 'yanco_related_posts_shortcode' );

php Enfold,relatedposts短代码

Enfold,relatedposts短代码

related-posts-shortcode.php
/**
 * Related Posts Shortcode
 */
function yanco_related_posts_shortcode( $atts ) {
	ob_start();
    get_template_part( 'includes/related-posts');
    $related_posts_obj = ob_get_contents();
    ob_end_clean();
    return $related_posts_obj;
}
add_shortcode( 'related_posts', 'yanco_related_posts_shortcode' );

php 修改Avia.js

修改Avia.js

modifying-avia-js.php
/**
 * Modified Avia.js
 * Modifications made to make enable mobile menu with 'double-tap-to-go' behavior
 */
if( !is_admin() ) {
    add_action('wp_enqueue_scripts', 'avia_register_child_frontend_scripts', 100);
}
function avia_register_child_frontend_scripts() {
	$child_theme_url = get_stylesheet_directory_uri();
	wp_dequeue_script('avia-default');

	//register js
	wp_register_script( 'avia-default-child', $child_theme_url.'/js/avia.js', array('jquery'), 1, true);
	wp_enqueue_script( 'avia-default-child' );
}

php 修改Avia.js

修改Avia.js

modifying-avia-js.php
/**
 * Modified Avia.js
 * Modifications made to make enable mobile menu with 'double-tap-to-go' behavior
 */
if( !is_admin() ) {
    add_action('wp_enqueue_scripts', 'avia_register_child_frontend_scripts', 100);
}
function avia_register_child_frontend_scripts() {
	$child_theme_url = get_stylesheet_directory_uri();
	wp_dequeue_script('avia-default');

	//register js
	wp_register_script( 'avia-default-child', $child_theme_url.'/js/avia.js', array('jquery'), 1, true);
	wp_enqueue_script( 'avia-default-child' );
}

php 为自定义帖子类型启用布局构建器示例

为自定义帖子类型启用布局构建器示例

layout-builder-for-cpt.php
/**
 * Enable Layout Builder for Custom Post Types
 */
add_theme_support('add_avia_builder_post_type_option');
add_theme_support('avia_template_builder_custom_post_type_grid');

add_filter('avf_builder_boxes','yanco_enable_cpt_layout_builder');
function yanco_enable_cpt_layout_builder( $boxes ) {
	$boxex = array();

	$boxes[] = array( 'title' =>__('Avia Layout Builder','avia_framework' ), 'id'=>'avia_builder', 'page'=>array('post','portfolio','page','product','ugekursus','medarbejder','hoejskoleophold', 'valgfag'), 'context'=>'normal', 'priority'=>'high', 'expandable'=>true );
    $boxes[] = array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page' , 'post', 'ugekursus', 'medarbejder', 'hoejskoleophold', 'valgfag'), 'context'=>'side', 'priority'=>'low');
    $boxes[] = array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio'), 'context'=>'normal', 'priority'=>'high' );
    $boxes[] = array( 'title' =>__('Breadcrumb Hierarchy','avia_framework' ), 'id'=>'hierarchy', 'page'=>array('portfolio'), 'context'=>'side', 'priority'=>'low');

	return $boxes;
}

php 为自定义帖子类型启用布局构建器示例

为自定义帖子类型启用布局构建器示例

layout-builder-for-cpt.php
/**
 * Enable Layout Builder for Custom Post Types
 */
add_theme_support('add_avia_builder_post_type_option');
add_theme_support('avia_template_builder_custom_post_type_grid');

add_filter('avf_builder_boxes','yanco_enable_cpt_layout_builder');
function yanco_enable_cpt_layout_builder( $boxes ) {
	$boxex = array();

	$boxes[] = array( 'title' =>__('Avia Layout Builder','avia_framework' ), 'id'=>'avia_builder', 'page'=>array('post','portfolio','page','product','ugekursus','medarbejder','hoejskoleophold', 'valgfag'), 'context'=>'normal', 'priority'=>'high', 'expandable'=>true );
    $boxes[] = array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page' , 'post', 'ugekursus', 'medarbejder', 'hoejskoleophold', 'valgfag'), 'context'=>'side', 'priority'=>'low');
    $boxes[] = array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio'), 'context'=>'normal', 'priority'=>'high' );
    $boxes[] = array( 'title' =>__('Breadcrumb Hierarchy','avia_framework' ), 'id'=>'hierarchy', 'page'=>array('portfolio'), 'context'=>'side', 'priority'=>'low');

	return $boxes;
}

php Avia Shortcodes Override <br/> <br/>在/ avia-override-shortcodes /中放置覆盖短代码

Avia Shortcodes Override <br/> <br/>在/ avia-override-shortcodes /中放置覆盖短代码

avia-shortcode-overrides.php
/**
 * Avia Shortcode Overrides
 */
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
function avia_include_shortcode_template($paths)
{
	$template_url = get_stylesheet_directory();
	array_unshift($paths, $template_url.'/avia-override-shortcodes/');

	return $paths;
}

php Avia Shortcodes Override <br/> <br/>在/ avia-override-shortcodes /中放置覆盖短代码

Avia Shortcodes Override <br/> <br/>在/ avia-override-shortcodes /中放置覆盖短代码

avia-shortcode-overrides.php
/**
 * Avia Shortcode Overrides
 */
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
function avia_include_shortcode_template($paths)
{
	$template_url = get_stylesheet_directory();
	array_unshift($paths, $template_url.'/avia-override-shortcodes/');

	return $paths;
}

php 修改WooCommerce Shop图像大小

修改WooCommerce Shop图像大小

avia-woocommerce-image-size.php
<?php

/**
	 * Modify Product Image HTML
	 */

	function yanco_avia_woocommerce_thumbnail($asdf)
	{
		global $product, $avia_config;
		$rating = $product->get_rating_html(); //get rating
		$ribbon_html = '';

		$id = get_the_ID();
		$size = 'large';

		$ribbon_html = yancoGetRibbonHtml('acf_woocommerce_product_ribbon_color', $product);

		echo "<div class='thumbnail_container'>";
			echo $ribbon_html;
			echo avia_woocommerce_gallery_first_thumbnail( $id , $size);
			echo get_the_post_thumbnail( $id , $size );
			if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>";
			if($product->product_type == 'simple') echo "<span class='cart-loading'></span>";
		echo "</div>";
	}