• louiese

    (@louiese)


    i have made a static page and a page template for it. but i hav a problem. i would like to be putting 6(up to 8) selected featured post on it- so that someone can click on it and be dirrected to the post.

    does any one have codes that can do this?(i am using arjuna-x theme)
    wil be grateful

Viewing 6 replies - 1 through 6 (of 6 total)
  • MichaelH

    (@michaelh)

    How do you designate a ‘selected feature post’. By category, by tag, by custom field?

    Thread Starter louiese

    (@louiese)

    i have put posts in categories. have left the tag field empty. so categories it must be

    MichaelH

    (@michaelh)

    Okay put this in your Page Template

    <?php
    $cat_id = get_cat_ID('featured');
    $args=array(
      'cat' => $cat_id,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => 8,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Featured Posts';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    JHouse

    (@jhouse)

    Hey Michael,

    I want to do this too, but by adding a custom field checkbox. I know how to set this up in the admin area, but not on the homepage. Do you have any example code that I might be able to use?

    Much thanks.

    Thread Starter louiese

    (@louiese)

    thanks that worked, but would have liked that it showed part of the post and the post picture.(show the post up to where the ‘More tag’ is)

    will u help on this pliz!!!

    Thread Starter louiese

    (@louiese)

    Hey MichaelH
    I put codes in the template page to show pict and very small summery of the post, then edited the above code to linked up with the post itself. pictures dint show, when i run the codes not in wordpress\..\theme – they run just fine and the pictures show.
    what could be the problem?
    even if it works it would be hard to use coz every time i want to change the front page featured post i would hav to change the code manually.

    do u hav any ready to use code that i can use to do this? (show part of the featured posts-picture and little text)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘front page’ is closed to new replies.