所以我想知道当在多个php文件中使用变量名时,是否有可能从特定的php文件中获取变量.一个例子是:
<header>
<title>
<?php echo $var1; ?>
</title>
</header>
Run Code Online (Sandbox Code Playgroud)
page1.php有$var1 = 'page1'
page2.php有$var1 = 'page2'
footer.php应该有 <a href="">$var1 from page1</a><a href="">$var1 from page2</a>
好吧,这个例子有点抽象,但我可以尽量做到.我想你得到了我得到的东西!所以这是我追求的页脚!有解决方案吗?
我目前正在尝试使用此字体访问一些替代字符字形。
字体的字符 sub 的命名如下:“A.alt”、“A.alt1”、“B.alt”等,因此它们没有可遵循的 unicode。
我发现了这一点,但是当使用 Inspect Element 时,CSS 属性只返回“未知属性名称”错误。还有其他方法可以做到这一点吗?
<html>
<meta charset="ISO-8859-1">
<title>Glyph-test</title>
<style>
h1 {
font-family: Baron neue;
}
h1 span.A-alt {
font-variant-alternates: character-variant(A.alt);
}
</style>
<h1>Testing alternative <span class="A-alt">A</span></h1>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个WP-网站,我希望有一个子菜单,每个菜单项,与李项为每个the_sub_field('info_block_header')。因此,我正在尝试创建一个内部带有ACF循环的walker,但是现在我不知道如何正确实现循环。这是我得到的,但结果很糟糕:
sidebar.php:
<aside>
<nav id="mainNav">
<?php
$dropdown = new dropdown_walker;
$mainNav = array(
'theme_location' => '',
'menu' => 'main-menu',
'container' => 'ul',
'container_class' => 'topmenu-{topmenu slug}-container',
'container_id' => 'topmenu',
'menu_class' => 'topmenu',
'menu_id' => 'topmenu-{topmenu slug}[-{increment}]',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '<h4>',
'link_after' => '</h4>',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
'walker' => $dropdown
);
wp_nav_menu( $mainNav );
?>
<?php get_search_form(); …Run Code Online (Sandbox Code Playgroud) 我正在使用高级自定义字段制作WP网站.在一个页面上,我想回显一个包含所有类别为"Studio"的帖子的循环.然后我想显示名为"studio_project_dia_img"的子字段中的第一个图像.我可以从repeater_field获取所有图像,但不仅仅是第一个
此代码有效(仅响应来自转发器字段的所有行):
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<li class="thumbs">
<a href="studio-single.html" class="clearfix">
<?php if (get_field('studio_project_dia')) : while(has_sub_field('studio_project_dia')): ?>
<img src="<?php echo get_sub_field('studio_project_dia_img', $post->ID); ?>" />
<?php endwhile; endif; ?>
<div class="thumbsText">
<h2><?php the_title(); ?></h2>
<h3><?php the_tags( 'Tags: ', ' / ', ''); ?></h3>
</div>
</a>
</div>
<?php edit_post_link('Edit this entry','','.'); ?>
</div>
<?php endwhile; endif; ?>
Run Code Online (Sandbox Code Playgroud)
这段代码没有:
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<li class="thumbs">
<a href="studio-single.html" class="clearfix">
<?php if (get_field('studio_project_dia')) : while(has_sub_field('studio_project_dia')): ?>
<?php
$rows = get_sub_field('studio_project_dia_img', …Run Code Online (Sandbox Code Playgroud) 简短的问题,我试图理解这个教程:http://superdit.com/2011/02/09/jquery-memory-game/
作为Javascript的新手我似乎无法找到声明'=='"'的意思......我理解"==",但不是空的双引号.
我正在尝试创建一个if语句.基于的字符串
$var = "Apple : Banana";
$array = explode(":", $var);
print_r($array); //array([0] => 'Apple' [1] => 'Banana')
if ($array[1] == "Banana") {
echo "Banana!";
}
Run Code Online (Sandbox Code Playgroud)