หัวข้อ: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: ubee158 ที่ 22 กันยายน 2009, 17:18:58 หน้าแรกเดิมเป็นแบบนี้ครับ
http://xxx.com <<เดิม ๆ content1 - category 1 content2 - category 3 content3 - category 5 content4 - category 9 content5 - category 2 ปรับใหม่โดย redirect url หรือแก้แบบ frontpage แล้วได้ url เป็นแบบนี้ http://xxx.com/category1 << นู๋ไม่เอา content1 - category 1 content6 - category 1 content8 - category 1 content13 - category 1 content20 - category 1 แต่ผมอยากให้เปิดมาหน้าแรกได้แบบนี้ครับ http://xxx.com << นู๋อยากได้ content1 - category 1 content6 - category 1 content8 - category 1 content13 - category 1 content20 - category 1 :-Xไม่ทราบว่าใครมี วิธีแก้ หรือ plugins ไหมครับ วอนผู้ใจบุญช่วยสงเคราะห์ทีครับ. หัวข้อ: Re: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: แมวมีเจ้าของ ที่ 22 กันยายน 2009, 23:46:25 ไม่รู้ว่าผมเข้าใจถูกป่าว แบบว่าแสดงบทความแยกตาม category
แต่ถ้าใช่ก้เอาไปปรับใช้ตามความเหมาะสมได้เลยครับ อิอิ อ้างถึง <?php $recent = new WP_Query("cat=7&showposts=3"); while($recent->have_posts()) : $recent->the_post();?> <ul><li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li></ul> cat=7 คือ หมายเลข หรือลำดับของ category ตัวอย่างคือ ลำดับที่ 7 แนะนำว่าให้มีบทความของแต่ละ category ก่อนนะ เวลาตั้งค่าจะได้รู้ว่าอันไหนของอันไหน (เพราะผมยังใช้วิธีสุ่มและจดจำบทความเอง แบบว่าไม่รู้เทคนิควิธีการดูเลขลำดับมันเลย) showposts=3 คือ จำนวนบทความที่ต้องการแสดง ตัวอย่างคือ แสดง 3 บทความ ปล. ถ้าเข้าใจผิด ไปคนละเรื่อง ก้อย่าถือสา แบบว่า มือใหม่หัดทำ เหมือนกัน อิอิ ร้อนวิชา เอิีกส์ หัวข้อ: Re: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: แมวมีเจ้าของ ที่ 22 กันยายน 2009, 23:52:56 อ้างถึง <?php $recent = new WP_Query("cat=7&showposts=3"); while($recent->have_posts()) : $recent->the_post();?> <ul><li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li></ul> ข้างบนนี้สำหรับแสดงลิงค์บทความอย่างเดียว แต่ถ้าอยากให้แสดงเนื้อหาด้วยก็เพิ่มนี่เข้าไป โค๊ด: <?php the_content('Read more...'); ?> เป็น อ้างถึง <?php $recent = new WP_Query("cat=7&showposts=3"); while($recent->have_posts()) : $recent->the_post();?> <ul><li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> <?php the_content('Read more...'); ?></li></ul> เพิ่มเติมที่ โค๊ด: http://codex.wordpress.org/The_Loop หัวข้อ: Re: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: ubee158 ที่ 23 กันยายน 2009, 14:02:44 :-[ ไม่ทราบว่าเอา code ไปวางใส่ไว้ทีไฟล์ไหนหรือครับ ผมเอาไปใส่ที่ index.php แล้วมัน error น่ะครับ
หัวข้อ: Re: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: แมวมีเจ้าของ ที่ 23 กันยายน 2009, 14:09:29 วางที่ index.php แหละครับ ลองเพิ่มตัวนี้เข้าไป โค๊ด: <?php endwhile; ?> เป็น อ้างถึง <?php $recent = new WP_Query("cat=7&showposts=3"); while($recent->have_posts()) : $recent->the_post();?> <ul><li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> <?php the_content('Read more...'); ?></li></ul><?php endwhile; ?> หัวข้อ: Re: wordpress อยากได้ url xxx.com หน้าแรกคัดเฉพาะ content ตาม category เริ่มหัวข้อโดย: Normaderm ที่ 23 กันยายน 2009, 14:13:17 บางธีม หน้าแรกอาจชื่อ home.php นะครับ ::)
|