1
我试图创建一个变化,每一个新的岗位被创建时的标题。最新帖子的精选图片也应该成为主页页眉,并带有一个按钮来查看该帖子。是否有多个header.php文件的最佳做法,还是应该有条件语句?您是否必须创建多个header.php文件才能拥有动态标头?
我试图创建一个变化,每一个新的岗位被创建时的标题。最新帖子的精选图片也应该成为主页页眉,并带有一个按钮来查看该帖子。是否有多个header.php文件的最佳做法,还是应该有条件语句?您是否必须创建多个header.php文件才能拥有动态标头?
你并不需要一个multuple动态标题。您的帖子需要一个标题。比方说,例如,你有
post.php中
你可能需要的东西的post.php中的文件一样包括“header.php文件”。在包含以下内容中,请尝试以下内容
//put this portion of the code in between the head tag somewhere
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
animation: fade-in 2s ease;
visibility: visible;
-webkit-backface-visibility: hidden;
}
@-webkit-keyframes fade-in{0%{opacity:0;} 100%{opacity:1;}}
@-moz-keyframes fade-in{0%{opacity:0} 100%{opacity:1}}
@-o-keyframes fade-in{0%{opacity:0} 100%{opacity:1}}
@keyframes fade-in{0%{opacity:0} 100%{opacity:1}}
</style>
</head>
<body>
<!--We appendin' on this div - ps: ids make sense here... punk-->
<div id="banner-load"></div>
<!--Don't forget Jquery-->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js'></script>
<!--New images on load -->
<script>
//Add your images, we'll set the path in the next step
var images = ['banner-1.jpg', 'banner-2.jpg', 'banner-3.jpg', 'banner-4.jpg];
//Build the img, then do a bit of maths to randomize load and append to a div. Add a touch off css to fade them badboys in all sexy like.
$('<img class="fade-in" src="images/' + images[Math.floor(Math.random() * images.length)] + '">').appendTo('#banner-load');
</script>
</body>
?>
确保在includes中记住包含文件时的头标签和主体标签的位置。
一个有条件的链接,或者可能与宇宙学徒_ONE learner_ – RiggsFolly
只能使一个,创建一个函数来得到你想要得到恼人的最新post.If图片,使用AJAX更改图片(无需重新加载页面)。如果您决定在100%的HTML网站中使用功能,则使用PHP毫无意义:)。 –
@MarinNedea所以,我没有你所说的话,但我的问题是,我改变所有的头。我想我努力在html中使用is_home()来设置我的if语句。 – rabowlen