如果变量不为空,我想显示一些HTML代码,否则我想什么都不显示.
我试过这段代码但不起作用:
<?php
$web = the_field('website');
if (isset($web)) {
?>
<span class="field-label">Website: </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a>
<?php
} else {
echo "Niente";
}
?>
Run Code Online (Sandbox Code Playgroud) 我有这个代码:
<script>
$(document).ready(function larg(){
var larghezza = $(document).width();
$("p.width").text("The width for the " + larghezza +
" is px.");
});
$(window).resize(function() {
larg();
});
</script>
Run Code Online (Sandbox Code Playgroud)
我想在窗口调整大小时调用函数"larg",但它不起作用..怎么做?
谢谢
我有一个Wordpress网站,其中的帖子被加载到iframe中.
这是有效的代码:
<a class="trick" rel="<?php the_permalink() ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
Run Code Online (Sandbox Code Playgroud)
$(文件).就绪(函数(){
Run Code Online (Sandbox Code Playgroud)$.ajaxSetup({cache:false}); $(".trick").click(function(){ var post_link = $(this).attr("rel"); $("#frame").css("display","block"); $("#frame").attr("url", post_link); $("body").css("overflow","hidden"); }); }); </script>
<iframe id="frame" frameborder="no" allowtransparency="true" width="100%" height="100%" scrolling="no" src=""></iframe>
Run Code Online (Sandbox Code Playgroud)
现在,如何从iframe内部关闭此加载的iframe?
主页是index.php(主要的wordpress循环),iframe的内容是single.php(单个帖子),没有页眉和页脚.
谢谢.
这就是我在single.php中得到的
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("#close").click(function(){
$('#frame', window.parent.document).remove();
});
});
</script>
</head>
<body>
<div id="container-single">
<button id="close" >Close</button>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article <?php post_class('single') ?> id="post-<?php the_ID(); ?>">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); …Run Code Online (Sandbox Code Playgroud) 我想知道如果当前滚动位置大于112px,如何将css规则分配给元素.
我试过这个,但它不起作用:
<script type="text/javascript">
$window.scrollTop(function(){
var a = 112;
var pos = $window.scrollTop();
if(pos > a) {
$("menu").css({
position: 'fixed'
});
}
else {
$("menu").css({
position: 'absolute',
top:'600px'
});
}
});
</script>
Run Code Online (Sandbox Code Playgroud) 我想在产品页面上显示magento静态块的内容,也可能在产品列表页面上显示.
静态块仅对于LOGGED IN USERS加入特定组(例如logged in,内部reseller,general而clients不是内部testing或内部的用户)可见guests.
PS我需要在侧边栏中添加它,我有分层导航.
我有这套代码我想应用于我的iframe,但它不起作用.
@media only screen
and (min-width : 320px)
and (max-width : 480px) {
#postframe article{display:none;}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.