您好我正在尝试在我的wordpress帖子页面中使用高级图层滑块。但是我的代码粘贴在header.php文件中仅适用于页面,而不是帖子,我可以看到短代码显示在帖子页面的顶部。反正是否容易包含插件所需的代码?
先谢谢了,
詹姆斯
抱歉格式化
single.php中
<?php
global $avia_config;
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
$title = __('Blog - Latest News', 'avia_framework'); //default blog title
$t_link = home_url('/');
$t_sub = "";
if(avia_get_option('frontpage') && $new = avia_get_option('blogpage'))
{
$title = get_the_title($new); //if the blog is attached to a page use this title
$t_link = get_permalink($new);
$t_sub = avia_post_meta($new, 'subtitle');
}
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title(array('heading'=>'strong', 'title' => $title, 'link' => $t_link, 'subtitle' => $t_sub));
&GT?; &#39;&GT;
<div class='container template-blog template-single-blog '>
<main class='content units <?php avia_layout_class( 'content' ); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*
*/
get_template_part( 'includes/loop', 'index' );
//show related posts based on tags if there are any
get_template_part( 'includes/related-posts');
//wordpress function that loads the comments template "comments.php"
comments_template( '/includes/comments.php');
?>
<!--end content-->
</main>
<?php
$avia_config['currently_viewing'] = "blog";
//get the sidebar
get_sidebar();
?>
</div><!--end container-->
</div><!-- close default .container_wrap element -->
page.php文件
<?php
全球$ avia_config;
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
?>
<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
<div class='container'>
<main class='template-page content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-page.php and that will be used instead.
*/
$avia_config['size'] = avia_layout_class( 'main' , false) == 'entry_without_sidebar' ? '' : 'entry_with_sidebar';
get_template_part( 'includes/loop', 'page' );
?>
<!--end content-->
</main>
<?php
//get the sidebar
$avia_config['currently_viewing'] = 'page';
get_sidebar();
?>
</div><!--end container-->
</div><!-- close default .container_wrap element -->
的header.php
<?php
global $avia_config;
$style = $avia_config['box_class'];
$responsive = avia_get_option('responsive_layout','responsive');
$blank = isset($avia_config['template']) ? $avia_config['template'] : "";
$headerS = !$blank ? avia_header_setting() : "";
$headerMenu = $responsive ? avia_get_option('header_menu','mobile_drop_down') : "";
&GT?; 类=&#34; &#34;&GT; &#34; /&GT;
RSS2 Feed&#34; HREF =&#34;&#34; /&GT; &#34; /&GT;
&#39 ;; ?&GT; *你的主题标签,或者你将打破许多插件,这 *通常使用此钩子来添加元素 *作为样式,脚本和元标记。 * / wp_head(); ?&GT;
&#39; body&#39;)); ?&GT;&GT;
<div id='wrap_all'>
<?php if(!$blank){ ?>
<header id='header' class=' header_color <?php avia_is_dark_bg('header_color'); echo " ".$headerMenu; ?>' <?php avia_markup_helper(array('context' => 'header','post_type'=>'forum'));?>>
<?php
if($responsive && $headerMenu == 'mobile_slide_out')
{
echo '<a id="advanced_menu_toggle" href="#" '.av_icon_string('mobile_menu').'></a>';
echo '<a id="advanced_menu_hide" href="#" '.av_icon_string('close').'></a>';
}
$social_args = array('outside'=>'ul', 'inside'=>'li', 'append' => '');
//subheader, only display when the user chooses a social header
if(strpos($headerS,'social_header') !== false)
{
?>
<div id='header_meta' class='container_wrap container_wrap_meta'>
<div class='container'>
<?php
/*
* display the themes social media icons, defined in the wordpress backend
* the avia_social_media_icons function is located in includes/helper-social-media-php
*/
if(strpos($headerS,'bottom_nav_header') === false) avia_social_media_icons($social_args);
//display the small submenu
echo "<nav class='sub_menu' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
$avia_theme_location = 'avia2';
$avia_menu_class = $avia_theme_location . '-menu';
$args = array(
'theme_location'=>$avia_theme_location,
'menu_id' =>$avia_menu_class,
'container_class' =>$avia_menu_class,
'fallback_cb' => '',
'container'=>'',
'echo' =>false
);
$nav = wp_nav_menu($args);
echo $nav;
$phone = avia_get_option('phone');
$phone_class = !empty($nav) ? "with_nav" : "";
if($phone) echo "<div class='phone-info {$phone_class}'><span>{$phone}</span></div>";
/*
* Hook that can be used for plugins and theme extensions (currently: the wpml language selector)
*/
do_action('avia_meta_header');
echo '</nav>';
?>
</div>
</div>
<?php } ?>
<div id='header_main' class='container_wrap container_wrap_logo'>
<?php
/*
* Hook that can be used for plugins and theme extensions (currently: the woocommerce shopping cart)
*/
do_action('ava_main_header');
?>
<div class='container'>
<?php
/*
* display the theme logo by checking if the default logo was overwritten in the backend.
* the function is located at framework/php/function-set-avia-frontend-functions.php in case you need to edit the output
*/
echo avia_logo(AVIA_BASE_URL.'images/layout/logo.png', false, 'strong');
if(strpos($headerS,'social_header') !== false && strpos($headerS,'bottom_nav_header') !== false) avia_social_media_icons($social_args);
/*
* display the main navigation menu
* modify the output in your wordpress admin backend at appearance->menus
*/
$extraOpen = $extraClose = "";
if(strpos($headerS,'bottom_nav_header') !== false){ $extraClose = "</div></div><div id='header_main_alternate' class='container_wrap'><div class='container'>"; }
echo $extraClose;
echo "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
$avia_theme_location = 'avia';
$avia_menu_class = $avia_theme_location . '-menu';
$args = array(
'theme_location' => $avia_theme_location,
'menu_id' => $avia_menu_class,
'container_class' => $avia_menu_class,
'fallback_cb' => 'avia_fallback_menu',
'walker' => new avia_responsive_mega_menu()
);
wp_nav_menu($args);
echo '</nav>';
/*
* Hook that can be used for plugins and theme extensions
*/
do_action('ava_after_main_menu');
?>
<!-- end container-->
</div>
<!-- end container_wrap-->
</div>
<div class='header_bg'></div>
<!-- end header -->
</header>
<?php } //end blank check ?>
<div id='main'>