رفتن به مطلب

درخواست تصویر شاخص خودکار در سایت دیگر


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

با سلام و درود

دوستان من یک سایت تفریحی دارم که فقط مطالب کپی میزنم

به همین بابت برای گذاشتن تصویر شاخص خودکار باید عکسا رو هاست خودم اپلود شن ولی من میخوام اولین عکس رو به طور خودکار بعنوان تصویر پیش فرض قرار بده

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

بعد این ادرس منه و اگه دقت کنین اون اسلایدر بالایی این کارو بطور کامل می کنه کسی میتونه کمکم کنه؟؟؟

ممنون میشم

ادرس

http://yashayish.ir/

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

بنده خیلی اماتو ر هستم

یا حق

لینک به ارسال

قبلا در انجمن بحث شده

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


function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //axe pish farz
$first_img = "http://wp-parsi.com/not.gif";
}
return $first_img;
}

و با کد زیر در پوسته:


<?php echo catch_that_image() ?>

  • امتیاز 4
لینک به ارسال

ممنون بابت کمکتون ولی من هرکاری کردم نتونستم جایگزین کنم چون خیلی اماتو ر هستم به همین خاطر ممنون میشم شما برام جایگزن کنین

اون کد اولی رو هم تو فانکشن گذاشتم حالا اونتابع مونده که بزارم پوستم ممنون میشم مشما کمکم کنین

اینم کلاس پست من


<div class="post" style="border:1px dashed #FF8000">

<div class="post-box">
<div class="post-top">
<h3> <a title="فرهنگ هنر و موسیقی( مشاهده آرشیو این بخش )" href="http://yashayish.ir/art">فرهنگ هنر و موسیقی</a></h3>
</div>
<div class="archive">
<h4>آخرین ها</h4>
<ul>
<?php
$my_query = new WP_Query('showposts=8&cat=10');
while ($my_query->have_posts()):
$my_query->the_post();
$do_not_duplicate = $post->ID;?>
<li>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a><br /></li>
<?php endwhile; ?>
</ul>
</div>
<div class="box-body">
<?php
//Code automatically inserted by Featurific for Wordpress plugin
if(is_home()) //If we're generating the home page (remove this line to make Featurific appear on all pages)...
if(function_exists('insert_featurific')) //If the Featurific plugin is activated...
insert_featurific(); //Insert the HTML code to embed Featurific
?>
<?php $recent = new WP_Query("cat=10&showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
<?php $date_post=get_the_time('m/j'); ?>

<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?><?php if($date_post==$date){echo '<font color="red"> جديد</font>';} ?></a></h2>
<div class="post-box-img">
<a href="<?php the_permalink() ?>"> <?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img style="width: 110px;height:90px ;" src="address tasvire jaygozin" />';}?></a>
</div>
<?php the_content_rss('', TRUE, '', 20); ?>
<?php endwhile; ?>
</div>

خیلی خیلیتشکر

لینک به ارسال

کد اول را در فایل functions قرار دهید

خط زیر را در کد فایل جایگزین کنید


<a href="<?php the_permalink() ?>"> <?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo catch_that_image();}?></a>

  • امتیاز 1
لینک به ارسال

جایگزین این خط کنید


<a href="<?php the_permalink() ?>"> <?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img style="width: 110px;height:90px ;" src="address tasvire jaygozin" />';}?></a>

  • امتیاز 1
لینک به ارسال

<a href="<?php the_permalink() ?>"> <?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo "<img src='" catch_that_image() . "'>";}?></a>

  • امتیاز 1
لینک به ارسال

<a href="<?php the_permalink() ?>"> <?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo "<img src='" . catch_that_image() . "'>";}?></a>

لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...