wordpress - Do you have to create multiple header.php files to have a dynamic header? -
i trying create header changes every time new post created. featured image of newest post should become home page header button see post. best practice have multiple header.php files or should have 1 conditional statements?
you don't need multuple dynamic header. need 1 header post. let's instance, have
post.php
in post.php file might need include "header.php". in include try following
//put portion of code in between 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 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 images, we'll set path in next step var images = ['banner-1.jpg', 'banner-2.jpg', 'banner-3.jpg', 'banner-4.jpg]; //build img, bit of maths randomize load , append div. add touch off css fade them badboys in sexy like. $('<img class="fade-in" src="images/' + images[math.floor(math.random() * images.length)] + '">').appendto('#banner-load'); </script> </body> ?>
make sure in includes remember head tags , body tags when including files.
here link github https://gist.github.com/stephenscaff/8266351
Comments
Post a Comment