This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="content"> | |
<p>Lorem Ipsum Anything</p> | |
<script type="text/javascript"> | |
if(window.location.href.match(/arg=testA/)){ | |
document.write('<button name="button">Click me</button>'); | |
}elseif(window.location.href.match(/arg=TestB/)){ | |
document.write('<button name="button">Click me now!</button>'); | |
}else{ | |
document.write('<button name="button">Show me</button>'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Thanks to Pascal Landau | |
** https://plus.google.com/105523642741376989823/posts | |
**/ | |
$handle = fopen("path/log.log","a"); | |
fwrite($handle, var_export($array_or_object, true)); | |
fclose($handle); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve List of Breadcrubms without Rich-Snippets Option | |
* put this in your functions.php located in the templates folder | |
* call this with <?php echo write_breadcrumb(); ?> inside yout template | |
*/ | |
function write_breadcrumb() { | |
$pid = $post->ID; | |
$trail = '<a href="/">Home</a>'; | |
if (is_front_page()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family: 'Fjalla One'; | |
font-style: normal; | |
font-weight: 400; | |
src: local('Fjalla One'), local('FjallaOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/fjallaone/ | |
v1/rxxXUYj4oZ6Q5oDJFtEd6r3hpw3pgy2gAi-Ip7WPMi0.woff) format('woff'); | |
} | |
@font-face { | |
font-family: 'Open Sans'; | |
font-style: normal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach(glob('./*.html') as $filePath) { | |
$file_contents = file_get_contents($filePath); | |
$file_content_replace = preg_replace('windows','linux',$file_contents); | |
file_put_contents($filePath,$file_content_replace); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Send debug code to the Javascript console | |
*/ | |
function debug_to_console($data) { | |
if(is_array($data) || is_object($data)) | |
{ | |
echo("<script> | |
if(console.debug!="undefined"){ | |
console.log('PHP: ".json_encode($data)."'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add this to yout functions.php file | |
// you may just want to kill all your RSS Feeds, wordpress does provide | |
remove_action('do_feed', 'disable_all_feeds', 1); | |
remove_action('do_feed_rdf', 'disable_all_feeds', 1); | |
remove_action('do_feed_rss', 'disable_all_feeds', 1); | |
remove_action('do_feed_rss2', 'disable_all_feeds', 1); | |
remove_action('do_feed_atom', 'disable_all_feeds', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if you are using no caching headers in your iframe sources, so you 'll always get an "filled" iframe. This does kick your layout sometimes. | |
// this is how to coollapse such iframes: | |
if($("#iframeid").contents().find("p").length) { | |
$('#iframeid').css('display', 'none'); | |
} | |
// this is how to kill all caches in the iframe source | |
// <head> | |
// <meta http-Equiv="Cache-Control" Content="no-cache"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this redirects all your old stuff to the main site of the new domain | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^old-domain.com [NC] | |
RewriteRule ^(.*)$ http://new-domain.com/ [L,R=301] | |
RewriteCond %{HTTP_HOST} ^www.old-domain.com [NC] | |
RewriteRule ^(.*)$ http://new-domain.com/ [L,R=301] | |
#this redirects all your old stuff to the new domain, leaving all deep urls like before | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^old-domain.com [NC] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One more cautios way of extracting all input fields at once is: | |
extract( $_POST, EXTR_OVERWRITE, "form_" ); | |
// This way all your input variables will be called $form_foo and $form_bar at least. | |
// Avoid doing that in the global scope - not because global is evil, but because nobody ever cleans up there. | |
// http://goo.gl/3Q5RV | |
// Thanks to Sergej Müller @wpSEO | |
// you know this how you are doing: | |
$username=$_POST["username"]; | |
$age=$_POST["age"]; |