Skip to content

Instantly share code, notes, and snippets.

@mwordpress
mwordpress / readme.htaccess
Last active February 10, 2017 21:55
the codes listed here is part of the following article : https://www.mwordpress.net/protect-files-and-folders-to-wordpress-blog/
# Protect Readme files
<FilesMatch "readme.html">
order allow,deny
deny from all
satisfy all
</FilesMatch>
<FilesMatch "readme.txt">
order allow,deny
deny from all
function wpse_footer_db_queries(){
echo '<!-- '.get_num_queries().' queries in '.timer_stop(0).' seconds. -->'.PHP_EOL;
}
add_action('wp_footer', 'wpse_footer_db_queries');
# BEGIN supercache
<IfModule mod_mime.c>
<FilesMatch "\.html\.gz$">
ForceType text/html
FileETag None
</FilesMatch>
AddEncoding gzip .gz
AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
@mwordpress
mwordpress / content-filter.php
Created February 10, 2017 22:35
the codes listed here is part of the following article : https://www.mwordpress.net/how-to-add-adsense-into-post-wordpress/
<?php
$content = apply_filters('the_content', $post->post_content);
$save = explode("</p>", $content);
$tcount = 0;
$adon = 0;
foreach($save as $item) {
echo $item;
echo "</p>";
if(preg_match('/<p> /',$item) == 0 && $tcount >= 1 && $adon == 0) {
$adon=1;
<?php
/*
* Generate feedburner urls
*/
function create_feed_data($feed_list) {
// create feed url for each category in given array
foreach($feed_list as $feed_slug => $feed_name) {
$feed_url = $feed_slug;
}
// create html input feed for each category in given array
<?php
/*
Template Name: Full Archive
*/
?>
<?php
/**
* The template for displaying pages
*
* This is the template that displays all pages by default.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /media/
RewriteRule ^resizer/(.*)x(.*)/r/(.*) resizer/resize.php?src=http://sitename.com/wp-content/uploads/$3&h=$2&w=$1&zc=0&s=1
</IfModule>
@mwordpress
mwordpress / scheduled-posts.php
Created February 12, 2017 05:21
this codes listed here is part of the following article : https://www.mwordpress.net/display-scheduled-posts-in-sidebar/
<?php
$param = array(
'post_status' => 'future',
'order' => 'ASC',
'post_per_page' => '5'
);
$scheduled_posts = new WP_Query($param);
if ($scheduled_posts->have_posts()) :
while ($scheduled_posts->have_posts()) : $scheduled_posts->the_post();
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXXXXXXX"
data-ad-slot="XXXXXXXXXX"
data-ad-format="auto">
</ins>
<script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>