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 | |
$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; |
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
# 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> |
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
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'); |
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
# Protect Readme files | |
<FilesMatch "readme.html"> | |
order allow,deny | |
deny from all | |
satisfy all | |
</FilesMatch> | |
<FilesMatch "readme.txt"> | |
order allow,deny | |
deny from all |
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 | |
$postscount = 5; | |
$param = array ( | |
'post__in' => get_post_commented($post_id = NULL), | |
'orderby' => 'comment_count', | |
'posts_per_page' => $postscount | |
); | |
$most_popular = new WP_Query($param); | |
echo '<ul>'; | |
while ($most_popular->have_posts()) : $most_popular->the_post(); |
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
/* | |
* Get attachment id for default image url | |
* $default url | |
*/ | |
function get_attachment_id_from_src($image_src) { | |
global $wpdb; | |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'"; | |
$id = $wpdb->get_var($query); | |
return $id; | |
} |
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
/* | |
* get content and clean | |
*/ | |
function mwp_post_content($post_id) { | |
$post = get_post($post_id); | |
$output = $post->post_content; | |
$replace = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@"; | |
$output = wp_strip_all_tags($output, true); | |
$output = strip_shortcodes($output); | |
$output = ltrim($output); |
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
<link rel="image_src" href="رابط الصورة" /> | |
<meta property="og:image" content="رابط الصورة" /> |
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
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> |