จะเพิ่ม Recent Post ลงไปใน Side Bar ยังไงครับ แก้โค๊ดไม่เป็น

เริ่มโดย vava, 11 มิถุนายน 2011, 11:42:27

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

vava

จะเพิ่ม Recent Post กับ Recen Comment ลงไปยังไงครับ พอดีไม่อยากใช้ widget เพราะเป็นเว็บปั่นน่ะครับ imacro แล้วช้า

อ้างถึง<h3><?php _e('Pages','lightword'); ?></h3>
<ul>
<?php wp_list_pages('title_li='); ?>
</ul>

<h3><?php _e('Categories','lightword'); ?></h3>
<ul>   
<?php wp_list_categories('title_li='); ?>
</ul>

<h3><?php _e('Blogroll','lightword'); ?></h3>
<ul>
<?php wp_list_bookmarks('title_li=&categorize=0'); ?>
</ul>

<h3><?php _e('Archive','lightword'); ?></h3>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

vava

[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

004275


น้องเหน่ง


yosima


Giffy

อ้างถึงจาก: yosima ใน 11 มิถุนายน 2011, 13:12:02
<?php wp_get_archives('type=postbypost&limit=5')?>

แก้ limit เอา

ขอถามเพิ่มอีกนิดนะคะ แล้วถ้าจะใส่เป็น tag ของโพสนี่เราต้องใช้คำสั่งแบบไหนหรอคะ?
ต้องไปแก้ใน function ด้วยมั๊ยคะ?

aek26

อ้างถึงจาก: Giffy ใน 11 มิถุนายน 2011, 13:26:35
อ้างถึงจาก: yosima ใน 11 มิถุนายน 2011, 13:12:02
<?php wp_get_archives('type=postbypost&limit=5')?>

แก้ limit เอา

ขอถามเพิ่มอีกนิดนะคะ แล้วถ้าจะใส่เป็น tag ของโพสนี่เราต้องใช้คำสั่งแบบไหนหรอคะ?
ต้องไปแก้ใน function ด้วยมั๊ยคะ?

ของ tag ประจำโพส์ต้องตัวนี้ครับ
<?php
echo get_the_tag_list('<p>Tags: ',', ','</p>');
?>

ประมาณนี้ครับ :wanwan019:
เพราะแสวงหา มิใช่เพราะรอคอย เพราะเชี่ยวชาญ มิใช่เพราะโอกาส เพราะสามารถ มิใช่เพราะโชคช่วย ดังนี้แล้ว "ลิขิตฟ้าหรือจะสู้มานะตน"
[direct=http://www.108keychain.com]พวงกุญแจ[/direct]
[direct=http://www.xn--12cgajg3a0jxbsn4esb4cb5c7i.com]พวงกุญแจอะคริลิค[/direct]
[direct=http://www.xn--12clet6fwa1b4j8c5a0d.com]พวงกุญแจไม้[/direct]
[direct=http://www.facebook.com/108keychain]ของชำร่วย[/direct]

duodenum2

[direct=http://cheapbooksbuy.com/]Buy Cheap Books[/direct]
[direct=http://downloadbuysoftware.com/]Buy Download Software[/direct]
[direct=http://shoesdealscheap.com/]Cheap Shoes Deals[/direct]
[direct=http://giftsvalentinesales.com/]Valentine Gifts Sales[/direct]
[direct=http://womensbootsugg.com]Womens Boots UGG[/direct]

Giffy

ขอบคุณทั้งสองท่านมากค่ะ Bookmark ไว้ละ ^^

จะลองเอาไปโมเข้ากับธีม จะได้ปั๊มเว็บได้เร็วขึ้น   :wanwan019:

+1 ทั้งสองท่านเลยค่ะ :wanwan017:

vava

[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

vava

[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

aek26

มีแต่แบบนี้ครับ
ตัว function มันครับ
<?php
function recent_comments$posts 5$size 25 ) {
    global 
$wpdb;
    
$sql "SELECT DISTINCT ID, post_title, post_password, comment_ID,
    comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
    comment_type,comment_author_url,
    SUBSTRING(comment_content,1,65) 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_password = ''
    ORDER BY comment_date_gmt DESC LIMIT "
.$posts;
 
    
$comments $wpdb->get_results($sql);
 
    foreach (
$comments as $comment) {
    
?>

    <li>
        <?php echo get_avatar$comment$size ); ?>
        <div class="info">
        <a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID?>" title="<?php _e('on ''showtime'); ?> <?php echo $comment->post_title?>">
            <?php echo strip_tags($comment->comment_author); ?>: <?php echo strip_tags($comment->com_excerpt); ?>...
        </a>
                <span class="meta"><?php the_time('j F Y'); ?></span>
        </div>
    <div class="clear"></div>
    </li>
    <?php
    
}
}
?>


เวลาเรียก
<?php recent_comments('5''25'); ?>
5 คือจำนวน comment
25 คือความยาวข้อความที่ให้แสดง

ประมาณนี้ครับ ลองดูครับ :wanwan019:
เพราะแสวงหา มิใช่เพราะรอคอย เพราะเชี่ยวชาญ มิใช่เพราะโอกาส เพราะสามารถ มิใช่เพราะโชคช่วย ดังนี้แล้ว "ลิขิตฟ้าหรือจะสู้มานะตน"
[direct=http://www.108keychain.com]พวงกุญแจ[/direct]
[direct=http://www.xn--12cgajg3a0jxbsn4esb4cb5c7i.com]พวงกุญแจอะคริลิค[/direct]
[direct=http://www.xn--12clet6fwa1b4j8c5a0d.com]พวงกุญแจไม้[/direct]
[direct=http://www.facebook.com/108keychain]ของชำร่วย[/direct]

duodenum2

อ้างถึงจาก: aek26 ใน 11 มิถุนายน 2011, 16:31:32
มีแต่แบบนี้ครับ
ตัว function มันครับ
<?php
function recent_comments$posts 5$size 25 ) {
    global 
$wpdb;
    
$sql "SELECT DISTINCT ID, post_title, post_password, comment_ID,
    comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
    comment_type,comment_author_url,
    SUBSTRING(comment_content,1,65) 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_password = ''
    ORDER BY comment_date_gmt DESC LIMIT "
.$posts;
 
    
$comments $wpdb->get_results($sql);
 
    foreach (
$comments as $comment) {
    
?>

    <li>
        <?php echo get_avatar$comment$size ); ?>
        <div class="info">
        <a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID?>" title="<?php _e('on ''showtime'); ?> <?php echo $comment->post_title?>">
            <?php echo strip_tags($comment->comment_author); ?>: <?php echo strip_tags($comment->com_excerpt); ?>...
        </a>
                <span class="meta"><?php the_time('j F Y'); ?></span>
        </div>
    <div class="clear"></div>
    </li>
    <?php
    
}
}
?>


เวลาเรียก
<?php recent_comments('5''25'); ?>
5 คือจำนวน comment
25 คือความยาวข้อความที่ให้แสดง

ประมาณนี้ครับ ลองดูครับ :wanwan019:

:wanwan004: สุดยอดครับท่าน ขอรับไปลองหน่อย
[direct=http://cheapbooksbuy.com/]Buy Cheap Books[/direct]
[direct=http://downloadbuysoftware.com/]Buy Download Software[/direct]
[direct=http://shoesdealscheap.com/]Cheap Shoes Deals[/direct]
[direct=http://giftsvalentinesales.com/]Valentine Gifts Sales[/direct]
[direct=http://womensbootsugg.com]Womens Boots UGG[/direct]

goddy008

ลัลลลล้า

vava

อ้างถึงจาก: aek26 ใน 11 มิถุนายน 2011, 16:31:32
มีแต่แบบนี้ครับ
ตัว function มันครับ
<?php
function recent_comments$posts 5$size 25 ) {
    global 
$wpdb;
    
$sql "SELECT DISTINCT ID, post_title, post_password, comment_ID,
    comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,
    comment_type,comment_author_url,
    SUBSTRING(comment_content,1,65) 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_password = ''
    ORDER BY comment_date_gmt DESC LIMIT "
.$posts;
 
    
$comments $wpdb->get_results($sql);
 
    foreach (
$comments as $comment) {
    
?>

    <li>
        <?php echo get_avatar$comment$size ); ?>
        <div class="info">
        <a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID?>" title="<?php _e('on ''showtime'); ?> <?php echo $comment->post_title?>">
            <?php echo strip_tags($comment->comment_author); ?>: <?php echo strip_tags($comment->com_excerpt); ?>...
        </a>
                <span class="meta"><?php the_time('j F Y'); ?></span>
        </div>
    <div class="clear"></div>
    </li>
    <?php
    
}
}
?>


เวลาเรียก
<?php recent_comments('5''25'); ?>
5 คือจำนวน comment
25 คือความยาวข้อความที่ให้แสดง

ประมาณนี้ครับ ลองดูครับ :wanwan019:

อันนี้เอาไปใช้ยังไงครับ รบกวนนิดนึงครับ  :-[
[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]

vava

[direct=http://www.somsaishop.com]สบู่ส้มใส เก็บเงินปลายทาง[/direct]
[direct=https://www.thaiwebb.com]Thaiwebb.com[/direct]
[direct=https://skin365.shop/]SKIN365[/direct]